Phone Link lets your bots use the apps you already pay for and are already signed in to on your own phone. It is the main way to connect an app in Allternit; a browser sign-in on a Sessions computer is the fallback. Allternit never asks for or stores your ChatGPT, Claude or other passwords. The bot uses the app the way you would, on your device.

Where to start it

Phone Link runs in Allternit Desktop, because the first setup needs a cable between your phone and your computer. Open it from any of these:
  • Settings → Connections › Setup › Link a phone (the button at the top)
  • During first-run setup, at Your AI, under Use the apps on your devices: pick Apps on your phone
On ai.allternit.com, the phone layout and the m.allternit.com app, the same buttons open a screen that tells you to set up from Allternit Desktop. Once the phone is linked, your bots can use it from any of your devices. Settings → Computers → Phones keeps the Android cable tools and the USB Agent, with a line that points here. Phone not next to your computer? An Android phone can also share its screen through the Allternit app, with no cable, and you can see and tap it from the web, the phone app, the iPhone app and Desktop: see Android live view. When Desktop has the phone over a cable or Wi-Fi, scrcpy over adb stays the main source and is used first; live view is the fallback. No spare phone? Cloud phones will run Android on an Allternit server and link the same way. They are not available yet. Before you start: sign in to the apps on your phone first. Allternit uses them as you’re signed in.

Which apps show up

Settings → Connections › Apps has one row per app, built from what your phones report: each app found on a linked phone, plus each browser sign-in on your Sessions computer. A row says how bots reach that app: On your phone (one line per phone, with its state), In a browser (your sign-ins), and Routes with the one bots use now and a pin. To sign in to an app on a linked phone, choose Connect on its row and pick the phone app: Allternit Desktop opens the app on the phone, you sign in there yourself, and Check reads the app’s screen to confirm it is signed in. Allternit never types into a sign-in screen or sees your password. See Connections › Connect a new app. Phone Link looks for the apps in Allternit’s phone app catalog: the AI apps (ChatGPT, Claude, Gemini, Grok, Kimi, Copilot, Perplexity), Telegram, and the most useful apps that also have a connector, such as Slack, Discord, WhatsApp, Instagram, X, Gmail, Notion, Google Drive, Asana, HubSpot, Shopify and Spotify — about a hundred in all, grouped the way the connector directory groups them. An app you install after setup shows up within about ten minutes on Android. Carrier placeholders don’t count: some phones ship an icon for an app (WhatsApp on some Moto phones) that only opens a page to install it. Phone Link 0.3.1 and later skip those, so the app appears once you really install it. On an iPhone, plug it in once (or run setup again) after installing an app: iOS doesn’t list installed apps over Wi-Fi. A linked app means your bots can open and work the app on your phone. A chat with ChatGPT, Claude or another AI app goes through the phone only when that app’s route passes all its checks for the app version on your phone; until then the row says what is missing, for example Not available: sending attachments, and bots use the next route. Setup shows one step at a time: what to do, why, and a button when the phone can’t report the step itself. You can cancel at any point, and closing the window stops a setup that’s still running. When it finishes, you see the phone’s name, its OS, and each app it found with its icon, marked Signed in or Not signed in once that’s been checked. In Settings › Connections › Setup each linked phone shows the icons of the apps it found and a count such as 17 apps · 1 signed in. Click the count to see them all, grouped by category. A green dot on an icon means signed in, an amber dot not signed in; no dot means it hasn’t been checked yet.

Android

You need Allternit Desktop, a USB cable, and the phone on the same Wi-Fi as your computer.
  1. On the phone, turn on Developer options: Settings › About phone › tap Build number seven times.
  2. Turn on USB debugging in Settings › Developer options.
  3. Plug the phone into your computer and start Phone Link. When the phone asks Allow USB debugging?, tap Allow. If the phone shows a Use USB for menu, pick No data transfer; it doesn’t matter. Tap I’ve done it in Allternit if it’s still waiting.
  4. Allternit installs the Allternit Phone Link helper on the phone and turns it on. You don’t need to sign in to anything; pairing is approved by the setup itself.
  5. When it says Connected, you can unplug the cable. The helper starts itself again when the phone restarts, and it keeps working over Wi-Fi from any linked device — you only set it up once.
To stop the helper, use Stop on its notification, or uninstall Allternit Phone Link from the phone. Live screen away from home. The phone’s live screen runs through a small screen service inside Phone Link (Android 13 or newer, phone joined to your Allternit mesh). Allternit Desktop starts that service for you whenever the phone is connected to it over USB or over Wireless debugging at home, and checks it every few minutes while it stays connected. Once started, it keeps running until the phone restarts, so you can leave home and still open the phone’s screen from Allternit, ai.allternit.com or the phone app. After the phone restarts, the service is off until Desktop can reach the phone again: bring the phone home on Wi-Fi once with your computer on and Allternit open (or plug it in). Phone Link turns on Wireless debugging by itself so Desktop can reconnect, and turns it back off once the screen service is running (only if Phone Link was the one that turned it on). Until then the live view says it is waiting for your computer.

iPhone

The old Allternit helper app on your iPhone is being retired. Your phone keeps working through the new routes, so you do not need to do anything today. New iPhone setups use the Allternit app instead. See How your assistant uses your iPhone, which also shows how to delete the old helper app and LocalDevVPN and turn off Developer Mode.
You need Allternit Desktop on a Mac and a cable. It’s one cable session, then it works over Wi-Fi. You do not need to put the iPhone in DFU or recovery mode.
  1. Plug your iPhone into this Mac.
  2. Unlock your iPhone and tap Trust. Enter your passcode if asked.
  3. Sign in with your Apple ID in Allternit Desktop, then enter the code Apple sends to your devices. No pop-up on your devices? Tap Text the code to •••• NN to get it by text instead, or on the iPhone open Settings › your name › Sign-In & Security › Get Verification Code. It’s used only to sign the Allternit helper for your own phone. A free Apple ID works. Your password goes to Apple and isn’t saved; the sign-in Apple returns is kept in your Mac’s Keychain, never on our servers.
  4. Turn on Developer Mode: Settings › Privacy & Security › Developer Mode › On, then Restart. Allternit already made this switch appear.
  5. After the restart, unlock the iPhone. A popup asks Turn on Developer Mode? Tap Turn On and enter your passcode. This is the step people miss: setup can’t finish without it.
  6. Allternit installs the helper on your iPhone.
  7. Trust the Allternit helper: Settings › General › VPN & Device Management › tap your Apple ID › Trust. (It only appears there once the helper is installed.) If the iPhone says its settings don’t allow apps from developers, follow its prompt to allow them first. Then tap I’ve done it.
  8. Allternit starts the helper. If the iPhone asks for its passcode, enter it. Allternit then moves the connection to Wi-Fi, checks the phone still answers without the cable, and says Connected. You can unplug the cable. You don’t need to approve anything else on the phone.
Keep the iPhone and the Mac on the same Wi-Fi network (not a guest network that isolates devices). After your iPhone restarts, the helper stops until its developer image is mounted again. Just plug the iPhone into your Mac: Allternit notices it on its own, remounts the image, restarts the helper and finds its new address — no clicks, no Apple ID, no installs. Desktop checks the helper once a minute and restarts it only after it misses two checks in a row, because a restart sends the iPhone to its Home Screen and a busy helper can miss one check. No Mac at hand? On the iPhone, open the iCTRL app › Mount without a Mac, then Start Server. About once a week. A free Apple ID signs the helper for 7 days. Starting two days before the signature runs out, Allternit renews it by itself the next time the iPhone is plugged into your Mac, reusing the saved Apple sign-in — normally nothing is asked of you. Only when that saved sign-in has expired does Phone Link setup ask for your Apple ID again. When the renewal can’t happen by itself, your Mac shows a notification that names the phone, the time its helper stops working and the one thing to do: Plug in iPhone (it isn’t on the cable) or Sign in to Apple for iPhone (the saved sign-in expired, or no Apple ID is saved). It also tells you when the helper is on the cable but won’t start: Trust the developer on iPhone (a renewal can bring a new developer certificate, which iOS asks you to trust once in Settings › General › VPN & Device Management) or Unlock iPhone (the helper never answered, usually because the phone is locked). You get one notification per cause, not one a minute. Plugged in, but Allternit says the iPhone isn’t on the cable? Unlock the iPhone and tap Trust if it asks, or unplug it and plug it in again. If it still isn’t seen, macOS’s USB phone service (usbmuxd) may be stuck: run sudo killall usbmuxd in Terminal. macOS starts it again right away, and the next check (within a minute) finds the phone. A free Apple ID can have only three of its own apps on a phone. Before installing, setup removes older copies of the Allternit helper (from an earlier setup or another Apple ID), so they don’t use up that limit. Your other apps are never touched. See your iPhone’s screen. Click Open next to the iPhone in Settings › Connections › Setup or Computers › Phones, or pick it under Connected phones in the rail. The Allternit phone frame shows the iPhone’s screen as live video, at up to 30 frames a second. You can tap, swipe and type in it, and so can your bots. iOS asks once each time the live screen starts: Allternit opens the screen-broadcast sheet on the iPhone and taps its start button (Start Broadcast, or Start Sharing on newer iOS) for you. If it can’t, the iPhone shows Start live screen; tap it, then the start button. A red status pill on the iPhone shows while the live screen runs. Closing the phone frame pauses it, so opening the iPhone again is instant. To end it, tap the red pill on the iPhone. In the frame, Esc goes back (a swipe from the left edge) and Home goes to the Home Screen. Turn the iPhone sideways and the frame turns with it, so a landscape app or video shows upright, and taps, swipes and Back still land where you point. Screen off on phone and the apps list are Android-only. Sound from the iPhone’s apps plays in Allternit too, and still plays on the iPhone. iOS doesn’t let apps capture phone calls or the microphone this way. The speaker button turns the sound on or off. Remove a phone: Settings › Connections › Setup › ⋯ next to the phone › Remove phone. Allternit forgets the phone on this computer (its link and pairing key, and on Android the screen connection). The helper app stays on the phone; link it again to set it up fresh. If a step stops with an error, Allternit says what happened and offers Try again when retrying can help. If you’d rather use hardware, the Allternit USB Agent also works with an iPhone. On Android, Phone Link can also spot error and crash dialogs from other apps and offer a fix in a notification. It is off until you turn it on. See Error offers.

What bots can do on a linked phone

Once a phone is linked, bots reach it with the same phone.* tools as any other phone, through Allternit Desktop’s tool gateway. Its serial in phone.devices starts with link:.
  • See and touch: phone.screenshot, phone.tap, phone.swipe, phone.type, phone.home. Tap coordinates follow the latest screenshot; the screenshot’s coordinate_space says which space taps use.
  • Read the screen: phone.read_ui (one line per element: class, label, id, bounds), phone.screen_text (just the text) and phone.find_and_tap (find an element and tap its centre) work on linked phones and on Android phones over adb. An iPhone on a USB Agent can’t read the screen as text — there the bot works from phone.screenshot.
  • Open apps: phone.open_app takes a catalog id (chatgpt, google_drive), an app name (Google Drive) or a package/bundle id. For common apps (Settings, Gmail, ChatGPT, Claude, WhatsApp, Discord, Chrome, Safari, Messages, Phone, Google Maps) the result also carries hints: a few short notes on where things are in that app, such as where the compose button sits.
  • Back and keys: phone.back works on both. On a linked iPhone it is the swipe from the left edge. phone.key takes enter, esc, tab, backspace, space, the arrow keys, home and back on a linked Android phone; a linked iPhone takes enter (it submits the field) and home.
  • Texts and calls (Android): phone.sms.send and phone.call.dial work on a linked Android phone, with the same approval, the same limits and the same emergency-number block as over adb. A linked iPhone can’t send texts or place calls for a bot.
  • Read a code from a text (Android): phone.sms.read reads recent texts in the inbox and can wait up to two minutes for one to arrive, for example a sign-in code an app just sent. It returns the messages and any codes found in them. Pass from to read only one sender’s texts. The first time a bot reads texts on a phone, you are asked to allow it in the same Needs you path as other approvals; after that, that bot reads on that phone without asking. A bot that doesn’t pass its bot_id, and any API-key caller, asks every time.
  • Approvals: before a bot pays, deletes, sends, calls, types a password or code, opens a bank, wallet or broker app or changes a security setting, it waits for you in Needs you. See Approvals for sensitive phone actions.
  • Tasks and skills: plain-English tasks (phone.task) and phone skills work on linked phones too: they run on the bot’s brain. See Phone runs and phone skills.
  • Bot voice on calls needs a call cable. With a cable from a linked phone to the Mac running Desktop, the bot answers that phone’s calls and talks on them (on iPhone, best effort). See Let your bot talk on its own phone.

Read messaging apps in Allternit

Allternit can read and send in some messaging apps on a linked Android phone by using the app the way you would: it opens the app, reads the screen, taps a conversation, and types. Discord is first (your direct messages and your servers’ text channels). More apps follow, one reader per app.
  • Open the app’s tile in the Allternit phone to see its conversations. Tap one to read it, and reply from the box at the bottom.
  • The phone’s screen moves while Allternit reads. Switch the phone frame to Linked phone to watch.
  • It reads what the app shows on screen: the conversation list and the latest messages in a conversation.
  • Text shows as text. Anything else in a message (images, link cards, embeds, stickers, attachments) shows as a picture cut from the phone’s screen, so it looks the way it does in the app. A card that was only partly on screen shows the part that was visible. Something that moves (a GIF, an animated sticker, a video) plays: when a read sees a picture change, Allternit records a few seconds of the phone’s screen right then and loops that part. If no clip could be recorded, the picture shows a ▶ to try again. This needs the phone’s screen connection (Settings › Computers › Phones). Only the pictures from each conversation’s latest read are kept, 20 MB at most in all: past that, the conversations you read longest ago keep their text and drop their pictures until you open them again.
  • What it reads stays on this computer (in Allternit Desktop’s data folder). It isn’t uploaded.
  • Until an app has a reader, its tile opens the app on the phone itself.

Phone health

Settings → Connections › Setup shows each linked phone’s state as an Apps: pill (for example Apps: Connected), the app rows under Apps repeat it per app, and phone.devices reports it to bots. On Android, an adb phone’s screen connects through wireless debugging, and a linked phone on your mesh also shows its screen through Phone Link’s screen service (see Live screen away from home and A phone for your bot). When a phone has both, Settings → Computers → Phones shows it as one row with Screen: … and Apps: …. The health states: Remounting and signature renewal are manual states at heart — they only appear on evidence, never from a guess. Desktop clears them only after the phone’s helper truly answers again: either on its own after an automatic recovery, or after you do the action above.

Away from home

During cable setup your phone also joins your private Allternit network, the same one your computers use. After that your bots reach the phone wherever it is: home Wi-Fi, another Wi-Fi network, or cellular. Nothing on the phone is opened to the internet, and other people’s devices can’t reach it. Everything sent to it stays encrypted with the key from pairing. This works on Android phones and iPhones. On an iPhone the helper itself must be running: after an iPhone restarts, plug it into your computer once — Allternit remounts and restarts the helper by itself — or tap Start Server in the iCTRL app, before bots can reach it again. If away-from-home setup can’t finish (for example, you’re not signed in to Allternit), the phone still works on your Wi-Fi. Plug it in and run setup again to finish.

Use a linked phone on your Sessions computer

If you have a Sessions computer (an always-on computer that runs your subscriptions), it can use a phone you linked on your Mac, so the phone’s apps work while your Mac is off. Your Mac gives the Sessions computer the phone’s pairing; you don’t set the phone up again, and nothing changes on the phone.
  1. Your Sessions computer must be on, with Allternit Desktop open on it.
  2. On your Mac, in Settings → Connections › Setup, choose Use on Sessions computer for the phone.
  3. Your Mac asks you to confirm. Choose Use on, followed by your Sessions computer’s name.
The phone then shows in the Sessions computer’s Linked phones too. Your Mac keeps its pairing. An iPhone still needs your Mac for two things, and the Sessions computer shows them as Needs you with the reason:
  • Renewing the helper, about once a week: plug the iPhone into your Mac and open Allternit there.
  • Remounting after the iPhone restarts: plug it into your Mac, or on the iPhone open iCTRL › Mount without a Mac, then Start Server.
A Sessions computer can’t do these because they need a cable to the iPhone.

For developers

Channel readers (surfaces/allternit-desktop/src/main/phone-channel-readers.ts). A ChannelAppSpec per app (conversations, open, messages, send, optional me) drives the app through the phone tool runner (phone.open_app, phone.read_ui, phone.tap, phone.find_and_tap, phone.type, phone.back), so approvals, rate limits and the busy indicator apply. phone-ui-tree.ts parses read_ui text into nodes. PhoneChannelReader runs one operation at a time and keeps a local copy in <userData>/phone/phone-channels.json (mode 600). IPC: phone:channel-apps, phone:channel-cached, phone:channel-conversations, phone:channel-messages, phone:channel-send, exposed as window.allternit.phones.channel*. The phone used is a healthy Phone Link phone that lists the app, else an online adb phone. To add an app, write its spec (match on accessibility labels and ids, never on coordinates) and register it in CHANNEL_SPECS. Desktop main runs the setup as a state machine (surfaces/allternit-desktop/src/main/phone-link.ts, with the platform drivers in phone-link-ios.ts and phone-link-android.ts). The renderer API is window.allternit.phoneLink; types are in phone-link-types.ts. The renderer side lives in allternit-ai src/components/phone-link/: PhoneLinkSetup (dialog on Desktop and web, bottom sheet on the phone layout and PWA), the compact PhoneLinkPanel used inline in onboarding, and usePhoneLink(). Types mirror the contract in src/lib/phone-link-bridge.ts; per-state copy is in phoneLinkCopy.ts, with the backend instruction and detail shown underneath when they say something different. Where window.allternit.phoneLink is missing (web, phone, PWA, Desktop builds from before Phone Link) the UI shows “Set up from Allternit Desktop”. Apple ID and 2FA values are cleared from component state before the call and never logged. Unmounting the setup while it’s running calls cancel(). Onboarding counts Phone Link as done only at ready_wifi. Preview with a mocked bridge: run vite and open /preview-phone-link.html?platform=ios&state=apple_id.

Pairing handover

surfaces/allternit-desktop/src/main/phone-link-handover.ts moves an existing pairing (the link record plus the phone-link.ictrl.<device> key record) from one Desktop to the person’s Sessions computer. It never re-pairs: the phone helpers refuse pairing over the mesh on purpose. Approving a new computer on the phone itself is a possible future addition and is not built. allternit-api reaches only the caller’s own bound, running Sessions computer, never the local gateway and never another owner’s computer. The receiving Desktop keeps an X25519 key pair (private half in its secure store, phone-link.handover-key). The Mac seals the payload to it with an ephemeral X25519 key, HKDF-SHA256 and AES-256-GCM, with the owner and key id bound in as associated data, so the API and the gateway only relay ciphertext. The receiver opens it, refuses another owner’s or another computer’s box, and writes the record (with handedOverFrom: { name, at }) and the key into its own stores. The Mac asks the person to confirm in a native dialog before anything is sent. Renderer API, window.allternit.phoneLink: handoverTargets() returns the bound Sessions computer as { computerId, name, ready, reason? } (an empty list when none is bound) and handover({ deviceId, computerId }) returns { ok: true, deviceId, computerName } or { ok: false, cancelled?, error, message }. phone.devices entries for a received phone carry handedOverFrom. handedOverHealth() in phone-link-health.ts rewrites the signature, remount and pairing actions to name the giving computer. The phone gateway starts at every launch (without giving bots the phone tools) so a computer with no phone yet can receive one.

Phone app catalog

Shell-service tools (Android). Keys, texts, calls, inbox reads and the accessibility repair run through the app’s shell server (ShellServerMain, shell uid, the same one that serves the live screen), not the accessibility service, so they work while it is off. Commands in ShellServerProtocol.kt: KEY <keycode>, SMS <subId> <to> <body-base64> (subId -1 = default SMS SIM), DIAL <number> [<subId>], SMSREAD <since_ms> [<from>] (answers OK <base64 content-query output>) and A11YON. Every argument is checked against a strict shape and run as argv with no sh -c; SMS and DIAL refuse emergency numbers. The helper’s sealed RPC methods key, sms_send, call_dial, sms_read and a11y_enable proxy to them (ServerHooks.shell, which starts the server first when it can). On Desktop, PhoneToolRunner.linkedCall runs phone.sms.send, phone.call.dial and phone.sms.read for link: serials: validation, gated() (approval, rate limits) and the emergency block happen there, and only then PhoneLinkBackend.sendSms / dial / readSms; PhoneLinkBackend.call itself refuses those names. parseSmsRows and extractCodes in phone-tools.ts are shared by the adb and linked lanes. When a call fails with the accessibility service off, healAccessibility (phone-link-backend.ts) calls a11y_enable once per A11Y_HEAL_MS and retries the call; probeLinkedPhone does the same before reporting ACCESSIBILITY_OFF. These need Phone Link 0.3.4 or newer; an older app answers “Method not found”, and the tool says to run setup over the cable to update it. The apps Phone Link looks for are data, not code: surfaces/allternit-desktop/src/main/phone-app-catalog.json (each app’s icon is picked in allternit-ai src/lib/phone-link-app-icons.ts, keyed by catalog id; add one there when you add an app), read by phone-app-catalog.ts. Each entry has an id, name and category, its iPhone bundle ids (ios) and Android packages (android), and where it applies the subscription gateway’s provider id (google for Gemini, microsoft for Copilot), the MCP connector id from cmd/allternit-api/assets/open-design/connectors.json (its category is that connector’s category) or a messaging channel. An entry may carry hints (short, factual navigation notes); built-in apps that aren’t Connections apps (Settings, Chrome, Safari, Messages, Phone) are in a separate system list that only supplies hints. appHints() looks them up by id, name, package or bundle id, and phone.open_app returns them as hints on every lane. Installed apps come back in phone.devices and PhoneLinkStatus.apps as { vendor, signedIn, name, category, provider? }, so the Subscriptions screen names and groups them without a list of its own; a gateway vendor’s phone app shares its row with that vendor’s logins.
  • Adding an app: add the entry, then run node scripts/verify-phone-app-catalog.mjs --only <id> in surfaces/allternit-desktop to check the ids against the App Store and Google Play. phone-app-catalog.test.ts fails on a duplicate id or store id, a connector id that isn’t in the connector catalog, a category that differs from the connector’s, or a provider the gateway doesn’t know.
  • Detection: the cable-time list (go-ios on iPhone, the helper’s list_apps on Android) is saved per phone. While a phone is healthy, Desktop re-reads it at most every ten minutes in the background (APPS_REFRESH_MS): Android’s list replaces the saved one; an iPhone’s wireless list can be partial, so it only adds apps. When an iPhone can’t list its apps at all, Desktop finds AI chat apps by launching them (IOS_PROBE_BUNDLES) and never probes the rest of the catalog.
States: idle, not_supported; iPhone needs_cable → trust_prompt → apple_id → two_factor → developer_mode → waiting_for_reboot → installing → trust_certificate (the certificate only appears in Settings after the install); Android usb_debugging → installing → pairing; then ready_wifi, or error with { code, message, retryable }. Each status carries a one-line instruction for the user. Once ready, apps lists the vendor apps found on the phone.

Android pipeline

phone-link-android.ts (AndroidDriver) runs the Android states with injected dependencies, wired in phone-link-ipc.ts:
  • adb (phone-adb.ts): Google’s platform-tools, downloaded on first use from dl.google.com and SHA-verified, never bundled. Used only for the one-time cable setup.
  • Helper APK (phone-android-helper.ts): the Phone Link Android app (app ID com.allternit.app from 0.4.0; com.allternit.phonelink before, and the Kotlin classes keep that package; source in surfaces/allternit-mobile/android) published under runtime.allternit.com/phone-link/android/<version>/ (manifest.json + APK, the manifest’s SHA-256 pinned per version in PINNED_ANDROID_MANIFESTS). Desktop skips the install when dumpsys package shows a versionCode at or above the manifest’s, otherwise adb install -r -g. Until a version is pinned, setup ends with helper_unavailable. ALLTERNIT_PHONE_LINK_ANDROID_APK overrides the APK path for dev builds.
  • The Allternit app (0.5.0+): the same APK’s launcher opens m.allternit.com as a Trusted Web Activity, and the status screen moves to the notification and the icon’s Phone Link shortcut. See Allternit for Android.
  • Moving from the old app ID: Android treats a new app ID as a different app, so an update can’t replace com.allternit.phonelink in place. Desktop reads the ID from the helper manifest’s packageName (a manifest without it is an old com.allternit.phonelink APK). When the new ID is pinned and setup finds the old app on the phone, it uninstalls it, then installs com.allternit.app and pairs again. Component names use the full class name (com.allternit.app/com.allternit.phonelink.PhoneLinkAccessibilityService), because the short /.Class form would look under the new ID.
  • Provisioning: exactly the app’s own provisioning script over adb shell: the ACCESS_RESTRICTED_SETTINGS appop (ignored before Android 13), the accessibility service appended to enabled_accessibility_services (other services are kept), accessibility_enabled 1, the battery-optimization whitelist, the notification permission, the foreground service, then the PROVISION broadcast (arm_pairing=true, allow_remote_access=true, port 8200, device name). The broadcast answers with the app’s device_id; setup then polls dumpsys accessibility (10 s) for the bound service and ends with accessibility_blocked if it never binds.
  • Pairing (iCTRL protocol v1, ictrl-client.ts): adb forward tcp:0 tcp:8200 to a loopback port (removed on every exit path), whoami must report the same device_id, then X25519 pair — the armed one-shot grant approves it with no tap on the phone. The key lives in the Keychain-backed secret store under phone-link.ictrl.android:<device id>, never in a file or log.
  • Wi-Fi: the phone’s wlan0 address is read over the cable; Desktop checks the app answers sealed device_info at <ip>:8200 with the paired key (wifi_unreachable otherwise), then lists the AI apps with sealed list_apps. The link record (userData/phone/phone-link-android.json, mode 0600) saves the device id, serial, name, OS, LAN host, apps and helper version.
  • Reconnect (reconnectAndroid, findPhoneHost in phone-link-discovery.ts): after a reboot the app is already listening again (it starts on boot), but DHCP may have moved it. The saved LAN host is probed first; if it doesn’t answer, the local subnets are scanned (up to a /22 = 1022 hosts, 64 at a time, 700 ms timeout) matching the stable device_id from plain /whoami — a host that answers with another id is never trusted.

iPhone pipeline

phone-link-ios.ts (IosDriver) runs the iPhone states with injected dependencies, wired in phone-link-ipc.ts:
  • go-ios (phone-goios.ts): MIT, v1.3.2, downloaded on first iPhone setup from its GitHub release and checked against a pinned SHA-256, never bundled. list, info, devmode get/reveal, tunnel start --userspace (no sudo; its tunnel identity lives in userData/phone/go-ios/tunnel-identity), image auto, install, apps --list, launch, runtest. Long-lived commands use spawnSidecar, so they die with the app.
  • Developer Disk Image: go-ios only mounts ddi-17E5179g. ensureDdi puts a SHA-pinned copy in the --basedir first (runtime.allternit.com, then go-ios’s own mirror, both checked against the same pin) so go-ios never downloads one itself.
  • Port forward (phone-usbmux.ts): Desktop’s own usbmuxd client, listening on 127.0.0.1 only. ios forward is not used because it listens on 0.0.0.0, which during setup would expose the runner’s one-shot auto-approved pairing to the LAN.
  • Runner (phone-ios-runner.ts): unsigned runner + host app built from our iCTRL fork and packaged by its Scripts/package-phone-link.sh (manifest with SHA-256 per file). Desktop downloads runtime.allternit.com/phone-link/ictrl/<version>/ and checks the manifest against PINNED_RUNNER_MANIFESTS; until a version is pinned, iPhone setup ends with runner_unavailable. ALLTERNIT_ICTRL_BASE_URL, ALLTERNIT_ICTRL_VERSION and ALLTERNIT_ICTRL_MANIFEST_SHA256 override for dev builds.
  • Signing: RunnerSigner. Unpackaged builds (or ALLTERNIT_PHONE_LINK_LOCAL_SIGNING=1) use LocalIdentitySigner, the Mac’s own Apple Development identity and an installed development profile that includes the phone. Shipped builds use SideloadSigner, the allternit-sideload sidecar (isideload) driven over JSON lines on stdin/stdout; the password is written to its stdin once, never to argv, env, disk or logs. Without the sidecar binary, setup ends with signer_unavailable. The sidecar is cmd/allternit-sideload (its README has the protocol, limits and security notes). It keeps Apple’s session, the signing key and the anisette identity in the macOS Keychain (service com.allternit.sideload), so a re-sign with an empty password reuses the session and skips 2FA, or answers password_required. It gives the helper stable per-team bundle ids (com.allternit.phonelink.<team id>.ictrl[.uitests.xctrunner]), so re-signs reuse the same App IDs, and signs the runner’s .xctest with the runner’s own id. Apple’s sign-in needs anisette headers. On a Mac the sidecar makes them with the Mac’s own AuthKit, as Xcode does (src/mac_anisette.rs, through a one-constructor patch of isideload in vendor/); since 2026-10-18 Apple answers -80045 to headers from emulated-device anisette servers. Only when AuthKit gives nothing does it use an anisette v3 server: ALLTERNIT_ANISETTE_URL, default https://ani.jkcoxson.com, which sees device headers but not the Apple ID or password (the sidecar is required in macOS packaging, npm run prepare:sideload). 2FA: two_factor_required carries the trusted number (masked) on the device route too; Desktop puts it in PhoneLinkStatus.textTo, and submitTwoFactor('sms') sends {"op":"two_factor_sms"} so Apple texts the code. Before installing, removeOldHelpers uninstalls our helpers with other bundle ids (<bundlePrefix>.*), because a free Apple ID may have only three sideloaded apps on a phone. On iOS 26, launching a helper whose developer isn’t trusted yet fails only with processcontrol Error code: 2, which phone-goios.ts reads as untrusted so setup shows the trust step.
  • Pairing (ictrl-client.ts): iCTRL protocol v1. X25519 pairing, then each JSON-RPC call sealed with HMAC-SHA256 (PRF-CTR encryption, encrypt-then-MAC, ±120 s timestamps, nonce replay cache on the phone). A skewed Mac clock is corrected once from the phone’s server_ts. The key is stored only through secure-store.ts (Keychain-backed), one entry per phone UDID. Desktop’s own runtest launch is the only place ICTRL_ALLOW_AUTH_ONCE=1 is set, so that first pairing needs no tap on the phone.
  • Wi-Fi: a runner started by runtest lives in an XCTest session carried by the USB tunnel and dies when the cable is pulled, and go-ios can’t carry that tunnel over Wi-Fi. So after pairing, Desktop turns on the runner’s Remote Access (config {allow_remote_access: true}, persisted on the phone), ends the cable session, relaunches the runner as a plain app (ios launch, the same as tapping its icon), then closes its own tunnel and forward and checks the runner still answers at <phone-ip>:8200 before reporting ready_wifi. If it doesn’t, setup ends with wifi_unreachable (retryable).
  • Reconnect (reconnectIos): a later start for a linked phone (state in userData/phone/phone-link-ios.json, no secrets) tries the saved LAN address first; if the address changed (DHCP), the phone is found on the LAN by its device id (findPhoneHost, same as Android); if the phone restarted, it remounts the disk image, relaunches the runner and reads its new address over the cable. Setup also leaves the Mac’s pairing record in the iCTRL host app’s container so the phone can remount without a Mac (iCTRL app › Settings › Mount without a Mac), and refreshes it on every cable reconnect.
  • Live screen (phone-ios-video.ts, iCTRL fork iCTRLBroadcast + iCTRLUITests/BroadcastIngest.swift): real video the way Android’s scrcpy lane works, not the runner’s screenshot stream (GET /stream, 5–7 fps). A ReplayKit Broadcast Upload Extension in the iCTRL host app encodes the screen with VideoToolbox (H.264, no B-frames, 30 fps, about 4 Mbit/s, keyframe every 2 s, SPS/PPS before each IDR). It sends the video over loopback TCP 127.0.0.1:8203 to the runner, so no App Group is needed. The runner serves it at GET /video?ticket=<stream_ticket> as packets of u8 type | u32 BE length | payload: 0 STATUS {broadcasting} (also every 2 s), 1 CONFIG {width,height,scale,rotation}, 2 FRAME (one Annex-B access unit), 3 ENDED {reason}. The extension only encodes while someone watches (R/P control bytes); a new viewer gets a fresh keyframe (K). Desktop’s IosVideoSession is a StreamSessionHandle, so PhoneStreamManager, the phone:stream-* IPC and the renderer’s WebCodecs decoder are shared with Android; the serial is link:<deviceId>. Input goes back as runner RPCs (tap, long_press, swipe, type, home), in UIKit points (pixels ÷ scale). Rotation: ReplayKit keeps encoding the panel in portrait and only labels the turn (CONFIG rotation, from RPVideoSampleOrientationKey; 90 = view the frame turned 90° counter-clockwise). IosVideoSession passes it on as PhoneStreamMeta.rotation and re-sends the meta when it changes; the renderer (allternit-ai src/lib/phone-stream/rotation.ts) draws the frame upright and maps pointer and wheel input back into the video’s own pixels, so every viewer, old or new, sends input in one space. The runner’s synthesized gestures (tap, drag, swipe) use that same fixed portrait space whatever the orientation (checked on the iOS Simulator, 2026-10-19), so they need no turning. Only two things change: long_press is sent with fast: true when turned, because its default XCUICoordinate path works in the rotated interface space, and Back swipes from the side of the panel that is the app’s left edge. A mid-stream size change (Android rotation, an iPhone resolution change) re-sends the meta through PhoneStreamManager, so Desktop, web and PWA viewers reshape the frame. The runner’s start_live_screen RPC opens the iCTRL app’s broadcast picker and taps Start Broadcast through XCUITest. When that doesn’t work, it returns needsTap and the picker stays on screen. live_screen_status and stop_live_screen complete the set. Sound: the extension encodes the .audioApp buffers to AAC-LC and sends packet types 4 AUDIO_CONFIG {codec:'aac', sampleRate, channels, asc} and 5 AUDIO (one raw access unit); IosVideoSession turns them into the same audioMeta/audioChunk events as Android. iOS stops a broadcast when the phone restarts, and no app can start one without that system sheet.
  • Recovery without a person (phone-ios-recovery.ts): a Desktop-main scheduler (one pass a minute plus one at launch; a pass with no linked iPhone is a single JSON read, so it costs nothing otherwise) walks each linked record plus the usbmuxd device list. A record whose expiresAt is within 48 h renews once the phone is on the cable: re-sign with the Keychain-saved Apple session (empty password, never a prompt), reinstall the runner + host app, relaunch over the cable and confirm the helper answers, then persist the new expiry — installing kills the running helper, so the relaunch goes through reconnectIos with forceCable: true instead of trusting the LAN probe. A linked iPhone that appears on USB while its helper stays silent gets reconnectIos (image auto → launch → confirm) with zero clicks. Over-Wi-Fi renewal is impossible with the pinned go-ios v1.3.2: its tunnel manager never tunnels a network device (shouldSkipDevice skips ConnectionType == "Network", issues #596/#532) and both image auto and ios launch need that tunnel on iOS 17+ — both passes require the cable. Anything needing a person (saved sign-in lapsed, 2FA, no cable, install failure) is left to the setup flow and health stays recovery: 'manual', and onNeedsYou(record, blocker) (cable, apple_sign_in, no_apple_id, failed, plus trust and unlock from reconnectIos’s onStuck when a renewal relaunch or a remount launches an untrusted helper or one that never answers) lets phone-service.ts show a macOS notification built by renewalNotice(), once per udid, cause and expiresAt; a pass that actually recovered a phone calls onRecovered, which re-probes that phone’s health so the state clears on evidence. Setup stores the signing Apple ID (email only, never the password) on the link record as appleId, which is what makes the empty-password re-sign possible.

Mesh (development switch)

Linked phones also join the user’s Allternit mesh (a Headscale tailnet) so the lane reaches them when they’re off the home Wi-Fi. PHONE_LINK_MESH_ENABLED (src/main/phone-link-mesh.ts) is on by default; ALLTERNIT_PHONE_LINK_MESH=0 turns it off, and then setup and the tool lane behave exactly as without this feature. The production policy isolates customers (autogroup:self, live since 2026-10-17), so only the user’s own devices can reach their phone. With the switch on, cable setup additionally enrolls the phone on the mesh. Android: after the Wi-Fi check succeeds, AndroidDriver mints a single-use pre-auth key (MeshManager.enrollForGizzi, needs the signed-in device token) and re-sends the PROVISION broadcast with --ez arm_pairing false --es mesh_control_url <url> --es mesh_auth_key '<key>' (single-quoted for the phone shell; the key is never logged or stored), then polls the LAN /whoami up to 60 s for mesh_state: 'running' with a mesh_host. iPhone: after cable pairing, IosDriver asks the runner’s GET /schema whether config lists a mesh_control_url param (feature-detect — older runners don’t have it and are skipped), sends one sealed config { mesh_control_url, mesh_auth_key }, and polls /whoami the same way. A failure to join — not signed in, enroll error, timeout — never fails setup: the phone finishes ready_wifi with meshPending: true and the detail “Connected on this Wi-Fi. To use it away from home too, plug it in and run setup again.” The join succeeded saves meshHost (<100.x>:8200) on the link record. The lane (cachedHostResolver in phone-link-backend.ts) then resolves a phone saved-host → LAN scan → mesh, in that order; the mesh proxy (MeshManager.proxyFor → 127.0.0.1:<port> sidecar) is accepted only when its /whoami reports the phone’s own device_id, and phone.devices entries gain path: 'lan' | 'mesh' saying which transport answered. phone-service.ts only wires meshProxy when the switch is on. Finishing a mesh join later. When setup couldn’t finish the mesh join (the phone is linked as home-only), Desktop finishes it by itself once the phone’s helper answers on the home network: the same /schema check, single-use key and sealed config call as setup (phone-mesh-retry.ts, at most every 10 minutes per phone, one [PhoneLink] mesh join retry log line per attempt). It then saves the mesh address and clears meshPending, so the phone works away from home without running setup again. Mesh self-heal. A phone’s embedded tsnet node can report running to Headscale while every tailnet connection to it resets (seen 2026-10-18 after a 9 h Headscale outage, fixed only by force-stopping the app). Two layers fix this without a person. On the phone, the Android helper (0.3.3+, in its :mesh process, MeshWatchdog.kt) and the iPhone runner (MeshWatchdog.swift, driven by MeshLink) check the node every 60 s through Node.Health() (infrastructure/mesh/tsnet-ios/mesh.go). That check reads the backend state, the mesh IP, whether the ServeLocal listener still accepts, and tailscale’s own health warnables: not-in-map-poll and mapresponse-timeout stand in for a stale netmap, since tsnet exposes no netmap timestamp, and no-derp-home, no-derp-connection and derp-timed-out cover a dead relay. After two bad checks the watchdog restarts the node, and it restarts at once when the listener has died. A restart keeps the state dir and node key. Repeat restarts back off at 60/120/300/600/900 s, and a node in needs_login is never restarted. A Mesh binary without Health() still runs, but the watchdog then sees only the state and the IP. On the computer, phone-mesh-heal.ts handles failures in resolveHelperStreamHost (the Android live screen), the mesh branch of cachedHostResolver, and helper or tool calls that hit an unreachable error on a mesh-resolved host. When the phone answers off the mesh (on its saved LAN host, or over the cable through an adb forward or a usbmux forward, but only with an adb that is already running), Desktop calls the sealed mesh_restart { wait: 20 } RPC. That RPC returns {restarted, deferred, mesh_state, mesh_host, previous_mesh_host, waited_ms}, and Desktop then retries the mesh route once. Desktop tries at most once per 2 min per phone and logs one [PhoneLink] mesh heal … line per attempt. A changed mesh_host is written back to the link record. Over the mesh itself, call mesh_restart { wait: 0 }, which restarts just after replying. Phones without the RPC answer unknown_method, and the heal gives up. Errors use stable codes. iPhone: ios_too_old, runner_unavailable, runner_download_failed, tools_unavailable, bad_credentials, password_required and anisette_unavailable (all three show the Apple ID form again with the reason), app_id_limit, certificate_limit, device_limit, no_identity, signer_unavailable, signing_failed, tunnel_failed, ddi_unavailable, ddi_mount_failed, install_failed, launch_failed, runner_start_failed, pair_failed, wifi_setup_failed, no_wifi, wifi_unreachable. Android: helper_unavailable (not retryable), tools_unavailable, install_failed, provision_failed, accessibility_blocked, pair_failed, no_wifi, wifi_unreachable.