Add Swift mobile terminal shell

Closed
LA
2mo ago
+36815-588

Summary

  • Adds the Swift mobile shell path with attach tickets, manual host pairing, workspace/terminal browsing, and terminal snapshots.
  • Adds the iOS/iPadOS terminal bottom action bar matching the Zig reference controls.
  • Adds Swift package coverage for raw input, viewport reporting, fallback terminal selection, manual host pairing, and bottom-bar behavior.

Verification

  • xcodebuildmcp swift-package test --package-path ios/cmuxMobilePackage --output text
  • jq empty ios/cmuxMobile/Resources/Localizable.xcstrings
  • git diff --check
  • swmob macOS tagged reload succeeded
  • swmob iPad simulator reload succeeded
  • swmob iPhone simulator reload succeeded
  • iPad rotation and typing dogfood captured in local report: http://127.0.0.1:17321/index.html

[!NOTE]
High Risk
Touches authentication priming, new network-facing mobile host/RPC and attach tickets, and changes live terminal input/PTY paths on macOS—areas that affect security and core terminal behavior.

Overview
Adds a Swift iOS/iPadOS mobile terminal path built on new CMUXMobileCore (pairing URLs, attach tickets/routes, framed sync, Network.framework TCP transport) plus Mac-side mobile host wiring: MobileHostService, attach ticket issuance, workspace list observers, and PTY byte teeing from Ghostty surfaces for remote terminal parity.

Auth no longer treats cached tokens or auto-login credentials as signed-in until validation finishes (CMUXAuthState.primed), and token reads can fall back to file storage when keychain misses.

Mac terminal behavior gains mobile viewport pixel/cell caps with border overlay, raw-byte socket input (including chunked text and \r handling), optional vsync off when no active display, and clipboard write capture for tests/sync.

CI/release hygiene: new path-filtered test-ios.yml (package + iPhone/iPad simulators), ghosttykit-normalized-v1 cache keys, per-job isolated DerivedData via CMUX_DERIVED_DATA_PATH, shared download-prebuilt-ghosttykit.sh (replacing inline curl in some workflows), and .gitignore updates for local iOS plist / experiment targets.

Reviewed by Cursor Bugbot for commit 85809a6f2c7ee02a3dcc50b0a16fc9491ac0ca31. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Ships a Swift iOS/iPadOS terminal shell powered by CMUXMobileCore and Ghostty with secure Tailscale/loopback pairing, Stack Auth sign‑in, and a Network.framework TCP transport. Finalizes attach authorization and route selection; hardens the mobile host/RPC lifecycle; bounds snapshots and viewport caps; and stabilizes terminal/input routing for the iOS beta.

  • Bug Fixes

    • Auth: keep cached user while validating tokens; never auto‑auth from stored or auto‑login credentials; return Apple sign‑in config errors; fall back to file tokens on keychain misses and switch mode for session; harden OAuth/provider URLs, status/envelope boundaries, and primed/restoring states; preserve cached auth on transient failures.
    • Pairing/transport: validate/expire attach tickets; try fallback routes; stricter route/endpoint checks; deterministic and restricted terminal create routing; bound connect/auth waits; publish routes only after listener readiness; scoped cancellation and idle socket/RPC cleanup; stop closed frame batches; reject malformed workspace/terminal IDs and stale scopes; keep workspace tickets unscoped; dismiss pairing sheet after connect; add keyboard dismissal; clear stale client on failed pairing; strengthen listener/auth and status checks.
    • Terminal/viewport/input: own and coalesce refresh tasks; clear viewport caps on disconnect; enforce pixel/cell caps; bound mobile snapshots; report input failures; stabilize delete keys and terminal picker; preserve colors; capture the next standard clipboard write without touching the general pasteboard; add viewport geometry recorder and a resize‑tracking UI test; settle viewport after resize.
    • UI/UX and tests: stabilize iPad menus, simulator checks, and text‑field focus; add mobile host authorization tests; merge scoped workspace updates for accurate list sync; keep background git metadata polling reliable in oversized workspaces; cap PR repo candidates.
    • Logging: redact mobile shell identifiers.
  • Release/CI

    • iOS beta polish: export‑compliance config, beta icon, fixed iOS OAuth flows.
    • New path‑filtered iOS simulator workflow (.github/workflows/test-ios.yml) with manual trigger, iPhone/iPad matrix, package tests, and ref/test filtering; normalized GhosttyKit cache key (ghosttykit-normalized-v1); isolated DerivedData via explicit -derivedDataPath; shared GhosttyKit download script; respect Swift warning budget for mobile RPC.
    • .gitignore: ignore local iOS App Store Connect plist and experiments/*/target/. Added experiments/iroh-byte-transport Rust prototype to validate the Iroh byte‑stream path (not linked to the app).

Summary by CodeRabbit

  • New Features

    • iOS app shell with pairing deeplinks, mobile-host RPC, attach-ticket issuance, and live terminal snapshots
    • Cross-platform CMUXMobileCore package and new transport options (network + experiment path)
  • Improvements

    • Rich terminal snapshot format with styled VT rendering (colors, wide/emoji, cursor/scrollback)
    • Mobile viewport limiting with border overlay and UI-test viewport capture/recording
  • Tests

    • iOS simulator CI workflow and expanded unit/UI test suites
  • Documentation

    • iOS mobile plan added
  • Chore

    • Ignore per-experiment build outputs (experiments/*/target/)

Review Change Stack