Architecture decision · Revised July 21, 2026

Orca Mobile delivery architecture

A comparison of a desktop-served hybrid mobile application and signed React Native OTA updates, with a staged recommendation that tests the highest-risk assumptions before Orca commits to either implementation.

Recommended: prototype Option B Fallback: signed OTA Decision gate: App Store submission Status: planning only

Recommended decision

Prototype Option B: keep a useful native companion shell, but deliver each paired desktop's matching mobile web application through the authenticated connection and render it in a locked-down WebView. Benchmark terminal and interaction performance, complete a security review, and validate the product through an actual App Store submission before a full rewrite. If any gate fails, proceed with Option A, the self-hosted signed expo-updates design documented here.

01 · Decision

Test Option B before building central OTA infrastructure

Option B attacks the larger long-term cost: Orca currently has separate desktop and mobile feature implementations connected by a compatibility-sensitive RPC boundary. Option A improves delivery speed but leaves that boundary and duplicated UI in place. Option B can remove most of both, but only if WebView performance, security, and App Review are acceptable.

Near-term action

Build a bounded vertical slice

Prototype host switching, source control, a sustained-output terminal, one file or diff flow, and one native capability. Do not rewrite the full mobile app before these paths pass the decision gates.

Fallback

Option A remains viable

The signed OTA architecture still provides materially faster React Native fixes. Its GCP, KMS, approval, runtime-version, and recovery design can proceed if the hybrid approach fails validation.

This is a sequencing recommendation, not approval to rearchitect. Migration cost is intentionally excluded from the architecture preference, but it remains relevant to scheduling after the prototype and store-review gates pass.

02 · Current state

Orca already has pieces of both designs

The mobile project uses Expo 55, React Native 0.83, Expo Router, and the new architecture. Most frequently changed behavior is TS/TSX. The repository also has a desktop-served web client, a same-server static asset handler, mobile-scoped RPC, and paired E2EE transports, but those pieces are not yet a secure privileged WebView delivery system.

Area Current fact Architecture implication
High-change features Source control, terminal, tasks, files, diffs, sessions, and UI polish Option A can update them; Option B can ship them with the desktop.
Native boundary Pairing, notifications, camera, image picking, clipboard, haptics, and audio These remain in a store-delivered shell under either option.
Terminal The React Native app already embeds xterm in a WebView Web technology is proven, but bridge and streaming cost are known risks.
Connectivity Direct and Relay paths use paired identity, secure storage, and E2EE RPC Option B should reuse this trust relationship instead of adding open HTTP.
Desktop web build A bundled full-desktop web client and static handler already exist A dedicated mobile web entry is still required.
Relay delivery Relay transports E2EE RPC frames, not HTTP web assets Option B needs an authenticated manifest and chunked asset protocol.
OTA client expo-updates and runtime-version targeting are not configured Option A still requires a new store shell before the first OTA release.
Important existing gap: the current browser web flow can import pairing material from a URL, and static assets may be served separately from E2EE RPC. Option B must not reuse those behaviors inside the privileged native shell.

03 · Candidate architectures

Two ways to shorten the mobile delivery loop

Option B · Stable hybrid shell with desktop-served web UI

Store-delivered native shell
 pairing · secure credentials · host selection · recovery
 notifications · deep links · camera · audio · image picker
 clipboard · haptics · versioned capability bridge
                         │
             paired identity + E2EE session
                         │
                         ▼
 Desktop release ──► dedicated mobile web bundle + matching RPC API
                         │
                         ▼
 authenticated bundle descriptor + immutable asset chunks
                         │
                         ▼
 app-controlled, per-host WebView origin and cache

The desktop build owns host-specific workspace UI and its API contract. A desktop update therefore carries the matching mobile UI. The shell owns long-lived secrets, networking policy, lifecycle, and native capabilities; web content receives only negotiated capabilities and host-scoped operations.

Option A · Signed React Native OTA updates

CI builds compatible React Native bundle + assets
                         │
             preview automatic / production approved
                         │
                         ▼
 Cloud KMS signs manifest ──► GCS immutable objects + CDN
                         │
                         ▼
 Cloud Run selects release from Firestore channel state
                         │
                         ▼
 expo-updates verifies, downloads, and caches
                         │
                         ▼
 apply on next cold launch; embedded bundle remains fallback

The existing React Native application remains the feature UI. Compatible JS bundles can ship between store releases, while native modules, permissions, entitlements, Expo or React Native upgrades, and custom audio code still require store binaries.

04 · Long-term comparison

Option B removes more maintenance, but has harder gates

Dimension Option B · Hybrid web UI Option A · Signed OTA
Primary benefit Desktop UI and API release together; much less feature duplication and skew Fast JS/TS fixes while preserving the existing native application
Compatibility boundary Narrow native bridge; each desktop serves its matching host UI Every supported mobile runtime must remain compatible with desktop RPC
Remaining version matrix Native shell × bridge version × desktop-served UI × OS WebView Native runtime × OTA bundle × desktop/API version
Central operations No OTA control plane; desktop packaging includes the web build Cloud Run, GCS/CDN, Firestore, KMS, CI approval, retention, telemetry
Security center Paired identity, authenticated assets, origin isolation, bridge policy OTA key, CI promotion, manifest service, storage, CDN, runtime targeting
Compromise scope A desktop controls its UI; a narrow bridge limits access to phone capabilities A compromised OTA publisher can target compatible installed runtimes
Performance risk Higher: startup, memory, gestures, accessibility, high-rate bridge traffic Lower architectural change; existing React Native behavior remains
Offline behavior Native recovery works; host UI needs a verified per-host cache Current, cached, or embedded app launches without the update service
Rollback unit Desktop and matching UI; prior cached UI also needs compatible server APIs Republished known-good update or rollback-to-embedded directive
User consistency Different paired desktop versions may show different mobile UI One mobile channel can present a more uniform UI across hosts
Store-review posture Meaningful uncertainty under minimum-functionality and remote-code rules More established pattern, still constrained by downloaded-functionality rules
Security-fix reach Host UI fixes reach desktops that take the matching desktop update A compatible fix can be promoted centrally to active mobile runtimes
What Option B does not eliminate: store releases for native changes, a versioned native capability contract, WebView and OS regressions, desktop release rollback, or testing across supported shell and desktop versions. It eliminates the largest compatibility boundary, not every boundary.

05 · Option B security

Treat the served UI as privileged code

Source-control, terminal, and file UI can issue consequential operations and invoke native capabilities. Authenticating RPC alone is insufficient: replaced HTML or JavaScript could operate through the user's legitimate session.

  1. Authenticate content to the paired desktop

    Prefer an immutable bundle descriptor and bounded asset chunks inside the existing authenticated E2EE connection. Pinned HTTPS/WSS tied to paired identity is an alternative only if it also works through direct, Relay, and SSH topologies. Never load privileged content over unauthenticated plain HTTP.

  2. Keep credentials in the native shell

    Never place pairing tokens or long-lived credentials in a URL, fragment, WebView storage, page source, navigation history, or logs. The web UI receives a host-scoped channel handle, not the pairing secret.

  3. Use an app-controlled origin per paired host

    Verify every asset hash before atomic activation and key the cache by paired desktop identity plus web build ID, not by a changing endpoint URL. Isolate web storage and service-worker scope between hosts.

  4. Lock navigation and the web platform surface

    Allow only the active Orca document and verified assets. Block iframes, popups, arbitrary navigation, mixed content, file access, and unnecessary permissions. Route approved external links through the native system browser.

  5. Apply a strict content security policy

    Default sources to none, permit only immutable self assets, prohibit inline evaluation, and constrain connections to the native broker or exact paired endpoint. Render untrusted repository HTML in a separate bridge-less sandbox.

Failure behavior

Fail closed to native recovery

Hash mismatches, unknown required bridge versions, navigation attempts, or WebView crashes return to a native retry screen, never an unverified network page.

Cache behavior

Keep last-known-good per host

Bound retention by paired identity and build ID, validate archive paths and size limits, remove the cache with the pairing, and never reuse it for another host.

06 · Native capability bridge

Small, typed, negotiated, and auditable

The handshake should exchange shellProtocolVersion, uiBuildId, active host identity, WebView-instance session ID, and supported capability versions. Optional unsupported capabilities stay hidden; an unsupported required baseline returns to native recovery with a store-update explanation.

Capability family Bridge contract Guardrails
Host RPC Mobile-scoped typed request, response, stream, cancel, and connection events Server allowlist, schemas, host binding, backpressure, size limits
Images System camera or image picker returns a bounded result or scoped stream User gesture, MIME and size limits, no arbitrary device paths
Microphone and audio Explicit start/stop session and bounded audio stream Visible state, permission gate, one owner, cleanup on background
Clipboard Separate read and write operations User gesture for reads, payload limits, platform privacy behavior
Haptics Small enum of semantic feedback types Rate limit; no arbitrary vibration patterns
External links Request native open for an absolute URL Scheme allowlist and confirmation where appropriate
Notifications and deep links Native shell routes typed events to the active host UI No credentials in payloads; validate host and route
Do not expose: JavaScript evaluation, arbitrary filesystem access, unrestricted URL loading, generic native-module invocation, secure-storage reads, or an RPC escape hatch around the server's mobile-method allowlist. Revoke capabilities on navigation, host switch, backgrounding, document reload, or WebView replacement.

07 · Performance and reliability

Measure the paths that make an IDE feel immediate

WebView is likely adequate for lists, forms, files, and diffs, but Orca should not infer whole-app performance from its current terminal WebView. That terminal also shows that frequent native-to-WebView messages require careful coalescing.

Risk Prototype requirement Failure signal
Cold and warm start Load a verified per-host cache; fetch only when the build ID changes Blank UI, routine network-gated launch, or visible multi-stage flicker
Terminal throughput Batch frames, enforce backpressure, test output, input, and reconnect Dropped bytes, ordering errors, high battery use, input lag, scroll jank
Large diffs and files Virtualize rows, stream content, and cap retained document state Memory pressure, WebView termination, or long main-thread tasks
Mobile interaction Test keyboard, IME, selection, safe areas, rotation, gestures, accessibility A desktop-responsive UI that remains awkward or inaccessible on touch
Host switching Revoke streams and capabilities, isolate storage, load matching UI Cross-host state, stale actions, or credentials surviving the switch
SSH and Relay latency Run direct, Relay, SSH-hosted, interrupted, and resumed paths Assets or RPC that work only on a local LAN

Preferred data path

Keep long-lived secrets native

Start with a native E2EE broker and batched typed bridge. If terminal throughput is inadequate, evaluate a short-lived host-scoped page channel, never the durable pairing credential.

Recovery ownership

Native UI remains available

Pairing, host selection, offline state, credential repair, crash recovery, and incompatible-shell messaging must not depend on served web content.

08 · App Store risk

Submission is a product gate, not a paperwork step

Apple guideline 4.2 says an app should provide utility and UI beyond a repackaged website. Guideline 2.5.2 restricts downloaded code that changes functionality, and 4.7.2 can restrict exposing native APIs to remotely delivered HTML5 or JavaScript software without prior permission. Orca should not characterize Option B as remote desktop under 4.2.7: the UI is rendered on the phone and connections may traverse the internet. A genuine native companion is more defensible than a wrapper, but acceptance is discretionary and may change between reviews.

Review package

Make the app fully reviewable

  • Provide a stable internet-accessible review host with representative data.
  • Supply durable credentials, a sample QR code, and exact pairing steps.
  • Explain the native features and why host-specific workspace UI is required.
  • Describe content delivery and native capability boundaries accurately.

Validation order

Submit before full migration

  • Use a production-shaped vertical slice, not an empty wrapper.
  • Exercise pairing, recovery, notification, camera or picker, and audio flows.
  • Treat rejection, required redesign, or unresolved permission as a failed gate.
  • Revalidate after material changes to remotely delivered functionality.
Approval is evidence, not a permanent exemption. TestFlight is not the gate. Record the production submission, notes, review environment, questions, and accepted behavior so later changes can be evaluated against concrete review history.

09 · Option A fallback

Signed self-hosted OTA remains the implementation-ready alternative

If Option B fails, use the open-source expo-updates client and Expo Updates Protocol with a small GCP control plane and immutable CDN delivery plane. Expo's sample custom server is a protocol demonstration, so Orca owns production hardening.

Manifest selection

Cloud Run + Firestore

Select by platform, explicit runtime version, and channel. Keep manifests and release objects immutable; mutable state records active releases and audit events.

Static delivery

GCS behind a CDN

Store content-addressed bundles and assets with immutable cache lifetimes. Service failure delays checks but does not block cached or embedded app launch.

Signing

Dedicated Cloud KMS RSA key

Use RSA_SIGN_PKCS1_2048_SHA256 with an embedded compatible X.509 trust root. Sign the exact manifest or directive bytes after production approval.

Release behavior

Quiet download, cold-launch apply

Preview releases publish automatically. Production uses a protected CI approval with Slack notification. Routine updates apply on the next cold launch.

Rollback semantics

An older channel pointer is not a reliable downgrade. A client that already installed the bad update normally continues to select the newer update in its local database. Republish known-good content as a new signed update with a newer identity, or serve a newer signed rollBackToEmbedded directive when the embedded store bundle is the intended recovery. A pointer change can contain exposure for clients that have not installed the release; it is not complete rollback.
Incident action Effect Required control
Contain Stop offering the bad release to clients that have not installed it Move or disable the channel pointer and audit the change
Republish known-good Installed clients receive old content under a newer update identity Create and sign a new manifest, verify assets, then promote
Return to embedded Client makes downloaded updates ineligible and uses the store bundle Newer signed directive and tested multipart server/client support

Signing and approval are separate

Desktop Windows signing uses SignPath's OSS program, whose key is SignPath-controlled and manually approved. SignPath documents arbitrary hash signing as a Code Signing Gateway feature, so the OSS arrangement should not be assumed to sign Expo manifests. Use a separate non-exportable RSA key in Cloud KMS. CI enforces human production approval; KMS performs the cryptographic operation after approval.

Expo pricing clarification: the discussed Production tier is about $199/month, subject to current terms. Its 50K allowance refers to unique users who download an update during the month, not downloads. Five thousand users downloading ten releases are roughly 5K update MAUs and 50K downloads.

10 · Validation plan

Resolve risk in the cheapest useful order

Phase 0

Write the contracts and threat model

  • Define authenticated asset delivery, chunk limits, and per-host cache identity.
  • Define bridge capabilities, versions, schemas, limits, revocation, and recovery.
  • Map direct, Relay, SSH, offline, host-switch, and pairing-removal flows.
  • Prepare App Review claims and a production-shaped review environment.
Phase 1

Build the Option B vertical slice

  • Keep pairing, secrets, host selection, connection, and recovery native.
  • Deliver a verified mobile web build without credentials in URLs or page storage.
  • Implement source control, terminal, one diff/file flow, and one native capability.
  • Apply CSP, origin isolation, navigation blocking, schemas, and server authorization.
Phase 2

Benchmark and attack the prototype

  • Test real low- and high-memory iOS and Android phones and tablets.
  • Measure terminal throughput, input, startup, battery, memory, and large diffs.
  • Test direct, Relay, SSH-hosted, offline, interrupted, resumed, and host switching.
  • Attempt XSS, asset substitution, cache confusion, navigation, and bridge fuzzing.
Prototype checkpoint · July 22, 2026: the first bounded vertical slice now delivers a content-addressed HTML package over paired E2EE RPC, validates bounded chunks and the final document, keeps a verified per-host last-known-good cache, locks navigation and network access with native policy plus a hash-based CSP, and exposes only workspace-list and selection-haptic bridge capabilities. It is intentionally read-only and behind an Experimental settings entry. An iPhone 17 Pro simulator check validated paired delivery, workspace rendering and bridge interaction, verified-cache startup while the desktop was offline, reconnect after desktop restart, cold launch, background/foreground, and rotation without prototype errors. It has not yet validated a physical device or App Review; those remain Phase 3 gates rather than inferred successes.

A bounded Phase 2 simulator probe subsequently delivered a 330 KiB package in seven verified chunks, then repeated 120-frame terminal-style updates and a 4,000-row diff workload ten times without a WebView process loss or progressive slowdown. Terminal runs took 1.98–2.00 seconds at the display cadence, with 17–33 ms longest frames and at most one frame over 24 ms; diff layout took 68–78 ms. The final package also cold-started from its verified cache, ran the workload with the desktop offline, and survived rotation. This is synthetic DOM churn, not yet Orca's real terminal engine, diff parser, or live terminal transport, so those integrations still need production-shaped validation.

The production bridge audit on July 24 aligned the shared contract and both native WebView transports on a 640 KiB serialized-envelope ceiling. Negotiated operation payloads are capped at 600 KiB, leaving a 40 KiB reserve for authenticated envelope metadata. This closes an earlier mismatch where broker-valid large Tasks file-content responses could exceed the native Swift/Kotlin 256 KiB ceiling. Cross-language source tests now guard the limits, and a signed iOS Simulator rebuild retained secure credentials and automatically restored Host 37's existing workspace. Android Debug Kotlin/Java compilation and module unit tests also pass; Android runtime and physical-device performance remain explicit open gates.

A follow-up compatibility audit now checks the shell bridge version against both manifest bounds before download and again inside the Swift/Kotlin verified cache before initial open or rollback. This prevents a native store update from loading an older cached page outside its declared testedThrough range. Automated range and native-source checks, both native compilers, and signed iOS cold restoration pass; the actual older/newer store-binary and Desktop-package matrix remains a release gate.
Phase 3

Submit the hybrid companion to App Review

  • Provide a reliable external review host, account, sample QR, and workspace.
  • Include accurate notes for native functions and desktop-served host UI.
  • Record reviewer questions, requested changes, and accepted product behavior.
  • Do not authorize full migration until the production submission passes.
Phase 4

Choose and implement one architecture

  • If every Option B gate passes, plan incremental migration and shell support policy.
  • If a gate fails, stop expansion and implement the Option A shell and GCP path.
  • Do not operate both delivery systems by default; that retains both burdens.
  • Keep native capability changes on the store path under either architecture.

11 · Decision gates

Conditions for choosing Option B

  • The production-shaped companion is accepted through an App Store submission.
  • Privileged web assets are authenticated to paired identity and activate atomically.
  • No long-lived credential appears in a URL, WebView storage, logs, or page state.
  • Navigation, origin isolation, CSP, and bridge validation fail closed under attack.
  • Older shells negotiate capabilities and degrade safely against newer desktops.
  • Terminal output, input, reconnect, and backpressure meet agreed device benchmarks.
  • Large diffs, keyboard, selection, rotation, gestures, and accessibility remain usable.
  • Direct, Relay, SSH-hosted, offline, resume, removal, and host switching pass.
  • Native recovery works after missing assets or WebView process termination.
  • The team accepts version-specific UI differences between paired desktops.
Decision rule: choose Option B only when every gate passes. Otherwise choose Option A. A failed App Review or security gate is an architecture constraint, not an implementation detail.

References

Primary specifications and policies