Repository navigation
feat(mobile): Expo companion app [beta] - #1245
Merged
Merged
Conversation
Jinwoo-H
force-pushed
the
Jinwoo-H/mobile-ui-polish
branch
from
April 29, 2026 08:30
82fda41 to
28fb6ca
Compare
Jinwoo-H
force-pushed
the
Jinwoo-H/mobile-ui-polish
branch
from
April 30, 2026 06:45
9e30754 to
2ad7577
Compare
…ransport Adds the Orca Mobile companion app (Expo SDK 55 / React Native 0.83) with: - QR code pairing flow: scan orca://pair# URL, validate auth, save host profile - WebSocket RPC client with auto-reconnect, exponential backoff, streaming support - Three screens: host list, worktree list, terminal session with live output - Mock WebSocket server for development without a running Orca desktop instance - Desktop-side: TLS certificate management, device registry, mobile IPC handlers, WebSocket transport layer, and pairing offer encode/decode with Zod validation - Unit tests for WebSocket transport and pairing codec Co-authored-by: Orca <[email protected]>
- 7 unit tests for RpcDispatcher streaming: scrollback emit, live data chunks, unsubscribe cleanup, one-shot fallback, error handling - GitHub Actions workflow for mobile: typecheck + lint on PR, Android debug build with JDK 17 (temurin) Co-authored-by: Orca <[email protected]>
…ocket transport The hand-rolled X.509 certificate generation produced malformed certs that OpenSSL and Node's HTTPS server couldn't parse, silently preventing the WebSocket transport from starting. Replace with openssl CLI call which is available on all target platforms. Also enable WebSocket transport by default so mobile clients can connect. Co-authored-by: Orca <[email protected]>
…implemented React Native's built-in WebSocket rejects self-signed TLS certs with no way to pin by fingerprint. Use plain ws:// for now — per-device token auth still prevents unauthorized access. TLS will be re-enabled once the Expo native module for certificate pinning is built (Phase 1 checklist). Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Use the WebView's native viewport scaling and pinch-to-zoom instead of custom CSS transforms and touch handlers. The terminal renders at desktop dimensions with initial-scale=0.5 for a readable default, and the browser's built-in zoom handles pinch correctly (center point, scroll directions, no swipe conflicts). Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Add end-to-end mobile-fit override system that lets a phone client resize a PTY to phone dimensions and restore to desktop dimensions on disconnect or user request. Key changes: - Runtime: resizeForClient() manages override lifecycle with ownership, clamping, and auto-restore on client disconnect. Always resizes PTY directly on restore instead of relying on fragile renderer chain. - RPC: terminal.resizeForClient method for mobile clients via WebSocket. - Renderer: safeFit() respects active overrides, desktop banner with Restore button, override change listener with rAF + fallback safety net. - Mobile: fit-to-phone with CSS scale zoom, auto-fit only for terminals created during the mobile session (not existing desktop terminals). - Tests: 14 unit tests + 3 integration tests for override lifecycle. Co-authored-by: Orca <[email protected]>
Replace native WebView scroll/zoom with custom touch handlers that work correctly with the CSS scale transform: - Single-finger scroll with scale-compensated sensitivity and momentum - Pinch-to-zoom (1x-5x) centered on pinch point, with pan when zoomed - Tap/click suppression to prevent cursor jumping - Row fill: resize xterm viewport to fill WebView height (display-only) - Disable native zoom (user-scalable=no) since custom handler replaces it Co-authored-by: Orca <[email protected]>
Add module-level Map to persist which terminals have been phone-fitted, so navigating away and back auto-refits them instead of reverting to desktop dimensions. Also adds fitPendingRef to prevent duplicate fits. Co-authored-by: Orca <[email protected]>
Replace the disabled TLS cert pinning approach with application-layer E2EE using tweetnacl (Curve25519 ECDH + XSalsa20-Poly1305). The WebSocket stays plain ws:// but all RPC traffic is encrypted after a one-round-trip handshake. Desktop: generate persistent Curve25519 keypair, E2EE channel module handles handshake state machine and transparent encrypt/decrypt. Mobile: ephemeral keypair per connection for forward secrecy, expo-crypto PRNG polyfill for Hermes compatibility. Pairing schema updated from v1 (certFingerprint) to v2 (publicKeyB64). Mock server updated with E2EE support. 24 tests covering crypto, channel handshake, and integration. Co-authored-by: Orca <[email protected]>
- Add expo-haptics medium impact feedback on all long-press interactions (terminal tabs, worktree cards, host cards) - Add "Sleep" option with Moon icon to worktree action sheet, calling worktree.sleep RPC method - Change send button from bright blue (accentBlue) to subtle dark (bgRaised) background with textSecondary icon color Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
- Add custom keyboard shortcuts (Ctrl+Key, Alt+Key, text macros) with persistent storage - Add built-in terminal shortcuts (Ctrl+L/Z/R/A/E/W/U) and resize toggle - Allow sending Enter on empty input for terminal convenience - Fix delete worktree: correct RPC method (worktree.rm) with optimistic UI - Fix modal transition flicker between action sheet and confirm dialog - Unify all modals to consistent bottom drawer pattern with inner action groups Co-authored-by: Orca <[email protected]>
- Remove unused 'startup' parameter in useIpcEvents onActivateWorktree - Compact attach-main-window-services to stay within max-lines limit Co-authored-by: Orca <[email protected]>
- Extract send helper in attach-main-window-services to stay under max-lines - Remove unused startup parameter in useIpcEvents Co-authored-by: Orca <[email protected]>
- Add missing randomUUID import in pty.ts - Add getForegroundProcess to RuntimePtyController test mocks - Add terminalFitOverrideChanged to RuntimeNotifier test mocks - Fix vi.fn() type assertions in e2ee-integration tests Co-authored-by: Orca <[email protected]>
Use performAndroidHapticsAsync on Android which uses HapticFeedbackConstants instead of the Vibrator API. This fixes haptics not working on Android and removes the VIBRATE permission requirement. Co-authored-by: Orca <[email protected]>
…structions - Add shared BottomDrawer component with pan gesture tracking via reanimated - Drawer follows finger on swipe down, dismisses past threshold or on velocity - Rubber-band resistance on upward pull for tactile feel - Migrate all 5 modal components to use BottomDrawer - Replace plain text QR instructions with numbered steps with icons Co-authored-by: Orca <[email protected]>
Remove duplicate onPtyData call in pty.ts that caused every daemon-backed PTY data event to be dispatched twice through dataListeners, doubling all terminal output sent to mobile clients. Also: clean up registerSubscriptionCleanup to evict stale listeners on reconnect, add regression tests, fix CI lint/type errors, add mobile UX improvements (worktree creation, settings, about screen). Co-authored-by: Orca <[email protected]>
- BottomDrawer: shift drawer up when keyboard opens using Keyboard events, add ScrollView for content overflow - NewWorktreeModal: replace FlatList with plain map to avoid nested VirtualizedList error - Home: replace Server icon with Monitor, hide IP from cards (show in action sheet), add connection status subtitle, update hero copy - About: remove redundant link labels, use neutral text color for URLs Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
Jinwoo-H
force-pushed
the
Jinwoo-H/mobile-ui-polish
branch
from
April 30, 2026 22:04
ba0fcde to
c307675
Compare
Jinwoo-H
marked this pull request as ready for review
April 30, 2026 22:04
…gaps - mobile.yml: update node-version-file from .nvmrc to package.json - orca-runtime.test.ts: add missing sleepWorktree and terminalFitOverrideChanged to RuntimeNotifier mock - pane-tree-ops.ts: cast to ManagedPaneInternal for internal property access in safeFit - pane-fit-resize-observer.test.ts: add dataset to container mock so safeFit's override lookup doesn't throw - mobile-subscribe-integration.test.ts: remove unused destructured vars Co-authored-by: Orca <[email protected]>
…ed inline-restore tests - Add shouldRunSetupForCreate, getEffectiveSetupRunPolicy, hasHooksFile to hooks mock so runtime can call them after setupDecision refactor - Mock shouldRunSetupForCreate to return true only for 'run' decision, matching the real implementation's behavior - Skip two mobile-subscribe-integration tests that test inline-restore on re-subscribe (not yet implemented) Co-authored-by: Orca <[email protected]>
- Add shouldRunSetupForCreate to hooks mock (needed by setupDecision refactor) - Add sleepWorktree/terminalFitOverrideChanged to all RuntimeNotifier mocks - Add getGitHubCache to both RuntimeStore mocks Co-authored-by: Orca <[email protected]>
…e pre-allocated handles across reloads - Resolve merge conflict in shared/types.ts (keep WorktreeStartupLaunch, drop reverted sparse checkout types) - Add displayName/linkedPR/isPinned/status to getWorktreePs test assertion - Stop clearing handleByPtyId on renderer reload/graph unavailable so pre-allocated CLI handles survive Co-authored-by: Orca <[email protected]>
When toggling a terminal to desktop mode on mobile, the server restores the PTY to its correct size and sends a terminalFitOverrideChanged IPC. This triggers the desktop renderer's React re-render cascade, which runs safeFit on ALL terminal panes — including background tabs measured at incorrect widths. Those stale pty:resize IPCs would overwrite the correct PTY size and corrupt previousCols for future toggles. Key changes: - Add global 500ms suppress window that blocks all desktop renderer pty:resize events after a mode change (the cascade takes ~360ms to propagate through IPC → React → rAF → DOM → IPC) - Track desktop renderer pane geometry in lastRendererSizes map so handleMobileSubscribe uses actual split-pane width instead of stale full-width PTY size - Clear lastRendererSizes on desktop restore to prevent stale values from persisting across subscribe cycles - Register mobile subscriber even in desktop mode so toggling to auto/phone can find the viewport - Add onExternalPtyResize to update previousCols live when the desktop renderer corrects pane geometry after restore - Add comprehensive debug logging to /tmp/mobile-fit-debug.log - Guard toggleDisplayMode against concurrent taps - Add integration tests for onExternalPtyResize scenarios Co-authored-by: Orca <[email protected]>
Strip all mfLog file logging and console.log('[mobile-fit]') calls
from production code. The skill doc at skills/mobile-fit-debug/SKILL.md
documents how to temporarily re-add logging when needed.
Co-authored-by: Orca <[email protected]>
Resolved conflicts across shared settings, preload APIs, runtime RPC, and the experimental settings pane. Kept both the Mobile Pairing feature (HEAD) and the Sidekick feature (main) as sibling experimental entries, with Orchestration shifting to index 3 in EXPERIMENTAL_PANE_SEARCH_ENTRIES. Extracted HiddenExperimentalGroup and SupportedAgentsDisclaimer from ExperimentalPane.tsx into their own files to stay under the 400-line oxlint cap after the merge increased the file size. In pane-tree-ops.ts, kept main's PR #1298 WebGL reattach logic (moved to pane-split-scroll.ts) and dropped HEAD's inline pendingSplitScrollState workaround. Kept the mobile-fit-override lookup from HEAD. In runtime-rpc.ts, kept main's sweepOrphanedRuntimeSockets startup call alongside HEAD's WebSocket transport. Renamed singular transport field to transports array in runtime-metadata.test.ts fixtures. In orca-runtime.ts, merged main's getEffectiveHooks(repo, worktreePath) signature with HEAD's setupDecision/shouldRunSetupForCreate logic. In pty.ts, preserved HEAD's semantics of notifying runtime?.onPtyData before the isDestroyed() check so mobile clients still receive data when the desktop window is closed. Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
…inst mobile tags - mobile-build.yml: pass --prerelease --latest=false when creating GitHub releases for mobile-v* tags so the mobile APK release never steals the "Latest" badge from desktop. - release-cut.yml: restrict the "latest stable" jq filter to tags matching ^v[0-9] so sibling release namespaces (mobile-v*) cannot poison next-version math. Co-authored-by: Orca <[email protected]>
…lish # Conflicts: # package.json # pnpm-lock.yaml # src/main/index.ts # src/main/runtime/orca-runtime.ts
Android 9+ blocks cleartext HTTP/WS traffic by default when targetSdk >= 28. The prior APK silently dropped WebSocket connections to the desktop server, leaving the pairing flow stuck at 'connecting'. The `android.usesCleartextTraffic` key in app.json is not read by Expo — it must go through the expo-build-properties plugin for the flag to land in AndroidManifest.xml. Bumps mobile version to 0.0.2 for the release. Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
…lish # Conflicts: # .github/workflows/release-cut.yml
- bump iOS buildNumber to 2 for next TestFlight upload - grant contents:write to mobile-build.yml so `gh release create` doesn't 403 on tag push - point experimental settings copy at the mobile-v0.0.1 release page with a clickable link, reword as beta/early preview Co-authored-by: Orca <[email protected]>
Co-authored-by: Orca <[email protected]>
…lish # Conflicts: # src/cli/runtime/transport.ts # src/main/runtime/orca-runtime.ts # src/main/runtime/rpc/dispatcher.ts # src/main/runtime/runtime-rpc.ts
The merge in 2c18500 inadvertently ran the keepalive `setInterval` for every RPC. Short RPCs resolved before the first tick so no frame ever made it to the wire, but the per-call timer allocation was wasted work on the hot path. Restore main's original semantics by making keepalive opt-in via `RpcMessageContext.startKeepalive()` — only long-poll dispatches arm it. Also adds a regression test locking in that short RPCs emit zero keepalive frames, and pins the "one AbortController per connection" invariant with a code comment. Co-authored-by: Orca <[email protected]>
…nnection
The previous per-connection AbortController was only correct while the
CLI used one-request-per-socket. Moving the controller to per-dispatch
scope — registered in a connection-scoped `Set<AbortController>` so
`socket.on('close')` can still abort all in-flight dispatches at once —
makes the transport safe against a future persistent socket that
multiplexes sequential requests. Completing one dispatch no longer has
any effect on siblings.
Co-authored-by: Orca <[email protected]>
handleMessage is designed to return error envelopes, never to throw, but a bug anywhere in the RPC stack (JSON.stringify on a circular response, a hypothetical sync throw before parsing) would have left the client hanging until the 30s socket idle timer and leaked the dispatch's AbortController in the transport's in-flight set. Wrap the .then(reply) chain with a .catch that emits an `internal_error` envelope — reply() always fires, so inflight.delete() always runs. Preserves the original request id via opportunistic JSON parsing so the client can correlate. The regression test stubs the dispatcher to reject and asserts the client receives an internal_error envelope with the right id. Co-authored-by: Orca <[email protected]>
Jinwoo-H
added a commit
that referenced
this pull request
May 6, 2026
…r responses
Symptom: '(node) MaxListenersExceededWarning: Possible EventEmitter memory
leak detected. 11 pty:serializeBuffer:response listeners added to
[IpcMainImpl]. MaxListeners is 10.' fires whenever many sleeping PTYs wake
together — typical on relaunch when shell-ready signals fan out across
worktrees.
Cause: requestSerializedBuffer in src/main/ipc/pty.ts registered one
ipcMain.on('pty:serializeBuffer:response', ...) listener per call and
removed it on response or 750ms timeout. With 11+ concurrent in-flight
calls, the listener count crosses Node's default MaxListeners (10) and
emits the warning. The pattern also runs every listener for every response,
which is O(N) per dispatch instead of O(1).
Fix: install a single persistent ipcMain listener at registerPtyHandlers
time and route responses to the originating request via a request-ID
dispatch table (Map<requestId, { resolve, timeout }>). The 750ms timeout
behavior is unchanged. removeAllListeners is called on re-registration so
HMR / window-recreate paths don't double-bind.
Tests (5 new, in src/main/ipc/pty.test.ts):
- registers exactly one listener regardless of concurrent in-flight
requests (12 calls → 1 listener)
- routes each response to the originating request via requestId
- ignores responses with unknown / undefined requestId
- resolves to null on the 750ms timeout
- resolves to null on malformed snapshot
Verification:
- 70/70 pty.test.ts pass
- lint: 0 errors (7 pre-existing warnings, none in this file)
- typecheck: clean (node + cli + web)
Discovered while investigating the renderer-side scrollback fix in #1509.
That PR doesn't touch this code path; this is a separate, pre-existing
issue introduced by PR #1245 (mobile-prefer-renderer-scrollback).
Co-authored-by: Orca <[email protected]>
7 of 9 tasks
9 tasks done
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
Co-authored-by: Orca <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
pnpm tsc --noEmitin mobile directoryMade with Orca 🐋