Mobile app
A phone uses OpenProgram through an app from the store, not a browser tab. The app carries the whole UI, so opening it reads nothing over the network but data; it pairs with a computer once and stays signed in. Conversations, files and accounts stay on the computer, as in remote web access.
- Computer: Add deviceA one-time QR code with every address of this computer
- App: scanRedeems the code for a device credential, kept in the Keychain
- App: openUI from the app, data from the first address that answers
Why an app, and why this shape
Opening the web UI through Tailscale Funnel took 10 to 20 seconds on a phone: about fifty requests at 0.7 to 1 second each, the UI's own files included, before the conversation list arrived. Every peer that is fast on a phone ships its UI on the phone and sends only data.
| Peer | How the phone gets the UI and data | Taken |
|---|---|---|
| Paseo | Expo app with its own UI; one end-to-end encrypted WebSocket to the computer's daemon through a relay or a Tailscale address; pairing by QR, never expires; list and recent messages cached on the phone | UI on the phone, data only on the wire, pair once and never ask again, network trouble is a reconnect and never a sign-in prompt |
| Claude Code, Codex, Copilot CLI | The vendor's phone app; the computer talks out to the vendor's relay | Store app. Not taken: a relay we would have to run |
| OpenCode | Web UI precached by a service worker; three requests at start, the rest when a view needs them | Few requests at start |
| DSH Mobile | Served by the computer, Tailscale Funnel for remote, LAN first | LAN first, Funnel as the remote way |
The app reuses the web UI instead of a second UI written for the phone (Paseo's way): one UI to keep, and the phone gets every feature the computer has. It is restyled for the phone (layout) rather than shown as the website.
The shell
apps/mobile/ios is a SwiftUI app around one WKWebView. It does not use Capacitor or Cordova: what it needs is one scheme handler and a few native calls, and a framework would sit in the way of the one part that matters, the request path.
| Part | How |
|---|---|
| UI files | The static export of apps/web (output: "export") is copied into the app at build time and served at openprogram://app/ by a WKURLSchemeHandler. Nothing of the UI crosses the network. |
| HTTP to the computer | The same handler takes /api/, /hooks/ and the other server paths and forwards them through one shared URLSession, so requests reuse its connections instead of paying a TLS handshake each, to the current address, adding Authorization: Bearer opd1.… and no Origin. Responses stream back chunk by chunk, so server-sent events work. To the page every request is same-origin: images, file previews and downloads need no change. |
| WebSocket | A custom scheme cannot carry WebSockets, so the page opens wss://<address>/ws itself. The app tells the page where (window.openprogramMobile.socket), and the credential goes in the handshake as a subprotocol, APP_BEARER_PREFIX followed by the credential, next to APP_SUBPROTOCOL (both in openprogram/interfaces/server/owner_auth.py), because a browser WebSocket cannot set headers. The server accepts this only from the app's origin openprogram://app, answers with APP_SUBPROTOCOL, and never echoes the credential. |
| Credential | The device credential of paired devices, unchanged: redeemed once, revoked from Settings → Devices, forgotten after 30 idle days. Kept in the Keychain, readable only after the first unlock. |
| Native calls | Scan a code (VisionKit), list, add, choose and forget computers, and haptics. The page calls them through one WKScriptMessageHandler; the app hands the page the paired computers (window.openprogramMobile.computers) for its picker, which asks the app to switch (selectComputer) or pair another (addComputer). Long-press menus are UIMenus the page describes (menuPress); menus opened by a tap are the page's own. |
Pairing and addresses
| Moment | What the app does |
|---|---|
| First screen | One action: scan the code from Settings → Devices → Add device on the computer, or paste its link with the system paste button, which asks no permission |
| Redeem | POST /api/auth/pair with no Origin returns {"device_id","token"} instead of a cookie |
| Choose an address | The link names every open address of the computer (Same Wi-Fi, Anywhere). The app asks every one /api/auth/session at once and uses the first that answers; a local answer within 300ms of a remote one still wins. Nobody picks an address |
| Network change or return | Starts from the address that answered last time and asks again |
| Address change | The page stays: requests read the current address, and the page is told the new socket address (openprogram-mobile-address). Back from the background, a socket that does not answer a ping within 2s is replaced at once |
| Start | The page shows the last chat list and project list of that computer before the socket is up (lib/mobile/session-list-cache.ts); until the first paint the view shows the page's own background, not white |
| Network failure | Retried on the next address, never shown as a sign-in problem |
| Revoked | A 401 while no address answers; the app returns to the scan screen for that computer |
Layout
The app's screens are a phone app of their own, built inside the web UI from its data and renderers (phone app).
| Screen | Holds |
|---|---|
| Projects | The first page; a project opens its chats, with a docked new-chat field |
| Conversation | Back and ⓘ; one composer menu for the turn's settings |
| Details | Changes, files, activity, resources and the chat's actions |
A swipe from the left edge goes one page back. The desktop's three columns as two drawers around the chat is rejected: it reads as a computer on a phone.
Implementation status
| Part | State |
|---|---|
| Built | The iOS shell, pairing, the server's WebSocket subprotocol, and the phone app's screens, which a phone's browser gets too. |
| Notifications | Notifications: a store app's push goes through Apple's service with a key that cannot live on the user's computer, so it needs a small relay. The first version notifies nothing while the app is closed. |
| Android | Android: the same design, with WebViewAssetLoader for the files; published as an APK on the GitHub release first, since Google Play does not reach mainland China. |
| Not built yet | Not built yet: iOS grouped lists in Settings, and the rest listed under the phone app. |
| Building the app | Compiling the app's icon and asset catalog needs an iOS Simulator runtime in Xcode (xcodebuild -downloadPlatform iOS); the Swift code compiles against the iOS SDK without it. |
| TestFlight | apps/mobile/scripts/testflight.sh builds the web UI into the app, archives it unsigned and exports it signed with the team's Apple Distribution certificate, so no device has to be registered, then uploads it; App Store Connect numbers the builds. It needs Xcode signed in to the team and the app's App Store Connect record. Internal testers install without review. The app declares its UserDefaults use in PrivacyInfo.xcprivacy. |
| Store review | Not submitted: a reviewer cannot pair a computer, so review needs a demo mode or a demo computer first. |