Repository navigation
Conversation
Repeatable rung-1/2/3 recipe for verifying client-owned display changes (theme + terminal render options) on a macOS workstation with Xcode. - notes/client-display-verify-harness.md: the recipe (SSOT) — three rungs, artifact convention, env prereqs, and the two named setup costs (web must be paired to a host; mobile needs a one-time Expo dev-client build). - config/scripts/verify-client-display.mjs: automates rung-1 repo gates and the rung-2 iOS-simulator light/dark capture via the simctl path (no WebDriverAgent). - .gitignore: ignore .verify-orca/ artifacts (attach to PRs, don't commit). Co-authored-by: Claude Opus 4.8 <[email protected]>
…1302] (#4) The runtime graph delivered one host-resolved RuntimeMobileTerminalTheme per terminal tab, so a mobile client was pinned to the host's current light/dark choice. Resolve and emit both palettes instead, applying terminalColorOverrides / terminalBackgroundOpacity / terminalCursorOpacity to each, so a client can pick its own appearance. The change is additive and backward-compatible: `mode` + `theme` stay populated with the host's systemPrefersDark-driven default (a client reading only those still renders), and an optional `palettes` field carries the light/dark pair alongside. Metadata only — the PTY byte stream and terminal content are untouched. Co-authored-by: Claude Opus 4.8 <[email protected]>
Record the already-made design decisions for the Client-owned display preferences effort: a paired mobile/web client picks its own light/dark instead of inheriting the desktop host's resolved terminal palette. Captures the three-bucket classification (host/PTY-authoritative, client render options, host-global behavior) and four decisions with their rejected alternatives and protected constraints: - terminal palette transport (host resolves both palettes, client picks) - CSI 997 arbitration via the existing floor-holder concept - client-local-by-default render prefs (server-persisted store out of v1) - web scope is verification-only Co-authored-by: Claude Opus 4.8 <[email protected]>
The mobile app chrome was hardcoded dark. Add a light palette and a theme
context that resolves the effective light/dark scheme from a stored
appearance preference plus the device's OS color scheme, then drive the app
chrome (root Stack screenOptions, home/pairing screen, settings) from it.
- mobile-theme.ts: add `lightColors` alongside `darkColors` with identical
token keys; `colors` still points at the dark palette so unmigrated screens
compile and render dark (the clean dark fallback the AC allows).
- theme-context.tsx: `ThemeProvider` + `useThemeColors()`; resolves 'system'
against React Native `useColorScheme()`, falling back to dark.
- preferences.ts: `appAppearance` ('system' | 'light' | 'dark', default
'system') load/save, following the terminalLinkOpenMode precedent.
- _layout.tsx: wrap the tree in ThemeProvider; Stack screenOptions and the
StatusBar style now read the active palette.
- index.tsx, settings.tsx: consume `useThemeColors()` via a memoized
StyleSheet factory; settings adds a System/Light/Dark control.
Other screens stay on the static dark `colors` fallback (AC-compliant).
Co-authored-by: Claude Opus 4.8 <[email protected]>
#6) * feat(mobile): client-owned terminal light/dark color scheme [CHE-1303] The mobile terminal rendered whatever palette the host baked in, so a paired iPad mirrored the host Mac's light/dark. CHE-1302 made the host ship both palettes; this lets the client pick its own. - preferences.ts: terminalColorScheme ('system'|'light'|'dark', default 'system') load/save, following the appAppearance precedent. A separate per-device choice from app-chrome appearance. - theme-context.tsx: ThemeProvider also resolves the terminal scheme (resolvedTerminalScheme) from the stored pref + useColorScheme(), so a change in settings or an OS appearance flip re-renders the session live. - terminal-color-scheme.ts: pure resolveTerminalThemeForScheme() picks palettes[scheme] into {mode, theme}; falls back to the host's single palette unchanged when palettes are absent (older host). - session screen: applies the pick to each terminal's theme at render. - terminal-settings.tsx: a Color theme picker (System / Light / Dark). - tests for the pref round-trip and the palette-pick helper. Co-Authored-By: Claude Opus 4.8 <[email protected]> * test(mobile): cover the terminal color-scheme resolution seam [CHE-1303] Extract the appearance→effective-scheme resolver into a pure resolve-scheme.ts (theme-context now imports it instead of defining it inline) and test the full decision the feature makes end-to-end without rendering: a stored terminalColorScheme plus the device OS scheme compose through resolveScheme → resolveTerminalThemeForScheme to the palette that renders. Covers: 'system' tracks the OS, an override wins over the OS, flipping the OS flips the palette on 'system', and the older-host single-palette fallback — the wiring a screenshot of the helper alone didn't exercise. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
# Conflicts: # mobile/app/_layout.tsx # mobile/app/index.tsx # mobile/app/settings.tsx # mobile/src/storage/preferences.test.ts # mobile/src/storage/preferences.ts
RN's TextInput only surfaces printable characters and Backspace on iOS, so a
physical Ctrl, Alt, arrow, Esc, Tab, or function key produced no JS event and
never reached the PTY — a hardware keyboard on iPad could only type text.
Add an expo-hardware-keyboard native module (iOS Swift + Android Kotlin) that
captures raw hardware key presses and forwards {key, modifiers} to JS, where the
existing buildTerminalShortcutKey() encodes the control bytes and the existing
sendLiveTerminalInput() delivers them. Wire a "physical keyboard" toggle into
the terminal session screen as a third input mode alongside buffered and live.
The byte-encoding reuses the audited terminal-accessory-keys logic; only the
native event source is new. terminal-hardware-key.ts is covered by unit tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…interception Redesign the hardware-keyboard capture UX from a separate "physical keyboard" toggle into a single "Live input" mode that auto-detects a connected hardware keyboard via isHardwareKeyboardConnected() (polled while live input is on, since no push event exists for attach/detach). With a keyboard attached, live input mounts OrcaKeyCaptureView instead of the TextInput path and never raises the software keyboard; without one it falls back to TextInput as before. This collapses two competing input-capture surfaces down to one and removes the now-redundant accessory-bar toggle button. Fix three device-only interception bugs found testing on a real iPad, none of which reproduced in the simulator: - Tab/Up/Down never reached this view at all: iPadOS's Focus Engine, a navigation system separate from the responder chain, was claiming them before pressesBegan/keyCommands ever fired. Opt into canBecomeFocused and drive it explicitly alongside becomeFirstResponder(). - Tab, Backspace, and the arrow keys were inconsistently swallowed by ancestor responders (field navigation, UIScrollView's built-in hardware-keyboard scrolling). Claim them as explicit UIKeyCommands so this view wins resolution before an ancestor sees them. - Ctrl+<letter> shortcuts reached pressesBegan with ctrlKey read as false. Same fix: claim the common shell-relevant combos (^C, ^D, ^L, ^Z, ^R, ^A, ^E, ^W, ^U) as explicit UIKeyCommands. Held-key repeat (Backspace, arrows) is a known follow-up, not fixed here: an explicit repeat timer was tried and pulled back out after on-device behavior didn't match expectations, and the device already appears to generate its own repeat invocations at a ~150-200ms cadence, so stacking a second repeat source on top risked over-repeating rather than fixing anything. See the comment above OrcaKeyCaptureView for detail. Co-Authored-By: Claude Sonnet 5 <[email protected]>
CI's format:check caught pre-existing formatting drift in two files from the original commit that predated this branch's lint-staged setup. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe changes add client-owned app and terminal appearance preferences with persisted storage and system-scheme resolution. Host runtime data now carries light and dark terminal palettes. Mobile screens consume theme tokens and expose appearance selectors. A new Expo module captures hardware keyboard events on Android and iOS, translates them into terminal bytes, and integrates them with session input. The changes also add terminal input extraction tests and a display verification harness for gates and simulator captures. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
🧹 Nitpick comments (5)
mobile/app/h/[hostId]/session/mobile-session-command-input-styles.ts (1)
168-170: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCondense or remove this implementation comment.
The three-line rationale is more detail than this style entry needs; use one brief non-obvious sentence if the comment is retained. As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”
Source: Coding guidelines
mobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsx (1)
5-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCondense these TypeScript comments.
mobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsx#L5-L10: reduce this to the cross-platform event distinction.mobile/src/terminal/terminal-hardware-key.ts#L7-L10: retain only why the structural type is local.mobile/src/terminal/terminal-hardware-key.ts#L22-L24: reduce to the HID-map purpose.mobile/src/terminal/terminal-hardware-key.ts#L55-L56: remove or reduce the self-evident function description.mobile/src/terminal/terminal-hardware-key.ts#L79-L81: reduce to the reason unmodified characters are used.As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
mobile/app/settings.tsx (1)
129-149: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd
accessibilityRole="radiogroup"to the container.The rows declare
radio, but the wrappingViewdoesn't declare the group, so screen readers announce three unrelated radios instead of a set with position/count context.♿ Proposed tweak
- <View style={styles.section}> + <View style={styles.section} accessibilityRole="radiogroup">mobile/app/h/[hostId]/session/[worktreeId].tsx (1)
1099-1108: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueConsider pausing the 1s poll while backgrounded.
The interval keeps firing a native query every second for as long as live input is on, including while the app is in the background (this screen already tracks
AppStateelsewhere). Gating onAppState.currentState === 'active'— or re-probing onAppState'active'plus a slower interval — would cut needless wakeups without changing behavior.mobile/src/theme/resolve-scheme.test.ts (1)
23-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten or remove this test walkthrough.
The test title and calls already convey this composition; retain at most a concise rationale.
As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6980c23d-1545-4701-82ac-f7b10182909a
⛔ Files ignored due to path filters (1)
mobile/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (40)
.gitignoreconfig/scripts/verify-client-display.mjsmobile/.oxlintrc.jsonmobile/app/_layout.tsxmobile/app/h/[hostId]/session/[worktreeId].tsxmobile/app/h/[hostId]/session/mobile-session-command-input-styles.tsmobile/app/index.tsxmobile/app/settings.tsxmobile/app/terminal-settings.tsxmobile/package.jsonmobile/packages/expo-hardware-keyboard/README.mdmobile/packages/expo-hardware-keyboard/android/build.gradlemobile/packages/expo-hardware-keyboard/android/src/main/AndroidManifest.xmlmobile/packages/expo-hardware-keyboard/android/src/main/java/expo/modules/hardwarekeyboard/ExpoHardwareKeyboardModule.ktmobile/packages/expo-hardware-keyboard/android/src/main/java/expo/modules/hardwarekeyboard/OrcaKeyCaptureView.ktmobile/packages/expo-hardware-keyboard/expo-module.config.jsonmobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboard.podspecmobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboardModule.swiftmobile/packages/expo-hardware-keyboard/ios/OrcaKeyCaptureView.swiftmobile/packages/expo-hardware-keyboard/package.jsonmobile/packages/expo-hardware-keyboard/src/ExpoHardwareKeyboardModule.tsmobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsxmobile/packages/expo-hardware-keyboard/src/index.tsmobile/packages/expo-hardware-keyboard/tsconfig.jsonmobile/src/storage/preferences.test.tsmobile/src/storage/preferences.tsmobile/src/terminal/terminal-color-scheme.test.tsmobile/src/terminal/terminal-color-scheme.tsmobile/src/terminal/terminal-hardware-key.test.tsmobile/src/terminal/terminal-hardware-key.tsmobile/src/terminal/terminal-live-input-affordance.test.tsmobile/src/theme/mobile-theme.tsmobile/src/theme/resolve-scheme.test.tsmobile/src/theme/resolve-scheme.tsmobile/src/theme/theme-context.tsxnotes/client-display-verify-harness.mdnotes/client-owned-display-preferences-design.mdsrc/renderer/src/runtime/sync-runtime-graph.test.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/shared/runtime-types.ts
Ten actionable findings plus five nitpicks from the stablyai#10447 review, spanning the hardware-keyboard feature and the theme feature it shipped alongside. Hardware-keyboard capture: - Guard isHardwareKeyboardConnected() against the native module being absent (older dev client, Expo Go): a throw during useState's lazy initializer would previously crash the whole session screen's first render instead of degrading to the TextInput fallback. - Gate the keyboard-connection poll on AppState — it no longer wakes every second while the app is backgrounded. - Serialize hardware-key sends per terminal handle (new createKeyedSendSequencer) so rapid/held typing can't fire concurrent terminal.send RPCs that resolve out of order and transpose characters. - Restore dictation/attach (MobileTerminalInputActions) in the hardware-keyboard input-bar branch, which silently dropped it; reorder OrcaKeyCaptureView to render behind the row instead of absoluteFill on top of it, so it no longer swallows taps on those buttons. - Fix isHardwareKeyboardConnected() unconditionally returning true on iOS <14 (GCKeyboard only exists 14+) — this suppressed the software-keyboard fallback for every pre-14 user, keyboard or not. Now returns false there. - Strengthen the Android key-precedence test: it always passed a non- conflicting keyCode (0), so it couldn't actually prove `key` wins over `keyCode` when they disagree. - Fix a missing StyleSheet import in the package README's usage example. - Extract the input-bar JSX (three input surfaces: hardware-keyboard capture, live TextInput, buffered command entry) into TerminalSessionInputBar, and the keyboard-connection state + send sequencing into useHardwareKeyInput, bringing the session screen back under its pre-existing max-lines budget instead of raising the cap. Theme feature (bundled into the same PR, not otherwise touched by the keyboard work, but flagged in the same review): - terminal-settings.tsx and TerminalShortcutSettings.tsx still rendered from the static build-time palette instead of useTheme()/makeStyles(colors), so Light appearance left this screen half-themed. Migrated both to the same factory pattern settings.tsx already uses. - theme-context.tsx: guard hydration so a load* resolving after the user has already changed a preference can't clobber it with the stale stored value; stop silently swallowing AsyncStorage write failures (now logged). - Add accessibilityRole="radiogroup" to the appearance picker. Condensed several over-long inline comments per the review's coding- guideline nitpicks; no behavior change. Not addressed: held-key repeat and full keyboard-passthrough remain the PR's stated known follow-ups, unrelated to this review pass. Verification: tsc --noEmit, oxlint, oxfmt --check, the repo's max-lines ratchet gate, and the full vitest suite (353 files / 2595 tests) all pass. Rebuilt clean on a real iPad (pre-fix, confirming the base feature still works) and on iOS Simulator (post-fix, confirming build/boot — hardware- keyboard capture itself isn't exercisable in-simulator; the iPad was offline for this pass and needs a hands-on re-check before merge). Co-Authored-By: Claude Sonnet 5 <[email protected]>
…keyboard-capture # Conflicts: # mobile/src/storage/preferences.ts
|
Addressed all 10 actionable findings from CodeRabbit's review plus the 5 nitpicks, and merged current Hardware-keyboard capture
Theme feature (bundled into this PR, flagged in the same review) — migrated Verification — Not addressed — held-key repeat and full keyboard-passthrough remain the PR's stated known follow-ups; unrelated to this review pass. CI shows |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
build-plugins/plain-node-entry-guard.js (1)
3-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCondense the implementation comments.
These multi-line comments restate behavior evident from the guard and entry list. Keep only the non-obvious plain-Node/Electron constraint in a short rationale. As per coding guidelines, “Comments must be concise, limited to non-obvious information, and preferably one line.”
Also applies to: 55-58, 88-89
Source: Coding guidelines
mobile/src/terminal/terminal-hardware-key-send-sequencer.ts (1)
1-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten implementation-walkthrough comments. Keep only the non-obvious rationale; these can each be concise one-line comments.
mobile/src/terminal/terminal-hardware-key-send-sequencer.ts#L1-L7: reduce to the ordering rationale.mobile/src/terminal/use-hardware-key-input.ts#L8-L10: retain only the missing-native-module fallback reason.mobile/src/terminal/use-hardware-key-input.ts#L31-L33: retain only the polling limitation.mobile/app/h/[hostId]/session/terminal-session-input-bar.tsx#L44-L49: remove extraction and branch walkthrough details.mobile/app/h/[hostId]/session/terminal-session-input-bar.tsx#L95-L99: retain only the capture-view layering rationale.As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a4dc9cf2-5e86-4e87-8740-dedac8a51ce3
📒 Files selected for processing (23)
build-plugins/plain-node-entry-guard.jsmobile/app/h/[hostId]/session/[worktreeId].tsxmobile/app/h/[hostId]/session/mobile-session-command-input-styles.tsmobile/app/h/[hostId]/session/terminal-session-input-bar.tsxmobile/app/index.tsxmobile/app/settings.tsxmobile/app/terminal-settings.tsxmobile/packages/expo-hardware-keyboard/README.mdmobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboardModule.swiftmobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsxmobile/src/components/TerminalShortcutSettings.tsxmobile/src/storage/preferences.test.tsmobile/src/storage/preferences.tsmobile/src/terminal/terminal-hardware-key-send-sequencer.test.tsmobile/src/terminal/terminal-hardware-key-send-sequencer.tsmobile/src/terminal/terminal-hardware-key.test.tsmobile/src/terminal/terminal-hardware-key.tsmobile/src/terminal/terminal-ios-dictation-write-back.test.tsmobile/src/terminal/terminal-ios-ime-keyboard.test.tsmobile/src/terminal/terminal-live-input-affordance.test.tsmobile/src/terminal/use-hardware-key-input.tsmobile/src/theme/resolve-scheme.test.tsmobile/src/theme/theme-context.tsx
🚧 Files skipped from review as they are similar to previous changes (12)
- mobile/packages/expo-hardware-keyboard/README.md
- mobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsx
- mobile/src/terminal/terminal-hardware-key.test.ts
- mobile/src/theme/resolve-scheme.test.ts
- mobile/src/theme/theme-context.tsx
- mobile/src/storage/preferences.test.ts
- mobile/src/terminal/terminal-hardware-key.ts
- mobile/app/index.tsx
- mobile/app/terminal-settings.tsx
- mobile/app/settings.tsx
- mobile/src/storage/preferences.ts
- mobile/app/h/[hostId]/session/[worktreeId].tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Verified on physical ipad with keyboard. Previously non-character keys like arrow or combos (CTRL+A, CTRL+E, etc.) would not work [ 20260724_153857.mp4](url) |
…keyboard-capture # Conflicts: # build-plugins/plain-node-entry-guard.js
…ure' into feat/mobile-hardware-keyboard-capture
…, run oxfmt Add a regression test for the fix CodeRabbit caught on the previous push (applied directly via GitHub): a rejected send whose key is never enqueued again left an unhandled promise rejection, since only the *next* read of the chain caught it. Confirmed the new test fails against the prior implementation and passes against the fix. Also runs oxfmt on the file, which the GitHub-applied commit didn't go through. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…keyboard-capture # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx # mobile/app/index.tsx # mobile/pnpm-lock.yaml
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
mobile/src/theme/mobile-theme.ts (1)
92-98: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReduce implementation comments that repeat visible code.
mobile/src/theme/mobile-theme.ts#L92-L98: Replace the visual-design narrative with one short rationale, or remove it.mobile/app/settings.tsx#L40-L41: Remove the comment because the array order and values are self-evident.As per coding guidelines, comments must be concise and limited to non-obvious information.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6cbd7b3b-267e-4c4b-810b-93b66186a6a8
⛔ Files ignored due to path filters (1)
mobile/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (48)
.gitignoreconfig/scripts/verify-client-display.mjsmobile/app/_layout.tsxmobile/app/h/[hostId]/session/[worktreeId].tsxmobile/app/index.tsxmobile/app/settings.tsxmobile/app/terminal-settings.tsxmobile/package.jsonmobile/packages/expo-hardware-keyboard/README.mdmobile/packages/expo-hardware-keyboard/android/build.gradlemobile/packages/expo-hardware-keyboard/android/src/main/AndroidManifest.xmlmobile/packages/expo-hardware-keyboard/android/src/main/java/expo/modules/hardwarekeyboard/ExpoHardwareKeyboardModule.ktmobile/packages/expo-hardware-keyboard/android/src/main/java/expo/modules/hardwarekeyboard/OrcaKeyCaptureView.ktmobile/packages/expo-hardware-keyboard/expo-module.config.jsonmobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboard.podspecmobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboardModule.swiftmobile/packages/expo-hardware-keyboard/ios/OrcaKeyCaptureView.swiftmobile/packages/expo-hardware-keyboard/package.jsonmobile/packages/expo-hardware-keyboard/src/ExpoHardwareKeyboardModule.tsmobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsxmobile/packages/expo-hardware-keyboard/src/index.tsmobile/packages/expo-hardware-keyboard/tsconfig.jsonmobile/src/components/TerminalShortcutSettings.tsxmobile/src/ime/ime-submit-carry.test.tsmobile/src/session/mobile-session-command-input-styles.tsmobile/src/session/terminal-session-input-bar.tsxmobile/src/storage/preferences.test.tsmobile/src/storage/preferences.tsmobile/src/terminal/terminal-color-scheme.test.tsmobile/src/terminal/terminal-color-scheme.tsmobile/src/terminal/terminal-hardware-key-send-sequencer.test.tsmobile/src/terminal/terminal-hardware-key-send-sequencer.tsmobile/src/terminal/terminal-hardware-key.test.tsmobile/src/terminal/terminal-hardware-key.tsmobile/src/terminal/terminal-input-connection-gate.test.tsmobile/src/terminal/terminal-ios-dictation-write-back.test.tsmobile/src/terminal/terminal-ios-ime-keyboard.test.tsmobile/src/terminal/terminal-live-input-affordance.test.tsmobile/src/terminal/use-hardware-key-input.tsmobile/src/theme/mobile-theme.tsmobile/src/theme/resolve-scheme.test.tsmobile/src/theme/resolve-scheme.tsmobile/src/theme/theme-context.tsxnotes/client-display-verify-harness.mdnotes/client-owned-display-preferences-design.mdsrc/renderer/src/runtime/sync-runtime-graph.test.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/shared/runtime-types.ts
🚧 Files skipped from review as they are similar to previous changes (37)
- mobile/packages/expo-hardware-keyboard/expo-module.config.json
- mobile/src/terminal/terminal-hardware-key-send-sequencer.ts
- mobile/packages/expo-hardware-keyboard/src/ExpoHardwareKeyboardModule.ts
- mobile/packages/expo-hardware-keyboard/android/src/main/AndroidManifest.xml
- mobile/src/storage/preferences.test.ts
- mobile/src/terminal/terminal-ios-dictation-write-back.test.ts
- mobile/src/terminal/terminal-color-scheme.test.ts
- mobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboardModule.swift
- mobile/packages/expo-hardware-keyboard/src/index.ts
- .gitignore
- mobile/packages/expo-hardware-keyboard/README.md
- mobile/packages/expo-hardware-keyboard/android/build.gradle
- mobile/src/terminal/terminal-live-input-affordance.test.ts
- mobile/src/terminal/terminal-color-scheme.ts
- mobile/packages/expo-hardware-keyboard/tsconfig.json
- mobile/packages/expo-hardware-keyboard/package.json
- mobile/src/terminal/terminal-hardware-key.test.ts
- mobile/src/theme/resolve-scheme.test.ts
- mobile/app/index.tsx
- mobile/package.json
- src/renderer/src/runtime/sync-runtime-graph.test.ts
- mobile/src/storage/preferences.ts
- config/scripts/verify-client-display.mjs
- mobile/src/terminal/terminal-hardware-key-send-sequencer.test.ts
- mobile/src/theme/resolve-scheme.ts
- mobile/packages/expo-hardware-keyboard/ios/OrcaKeyCaptureView.swift
- mobile/packages/expo-hardware-keyboard/src/OrcaKeyCaptureView.tsx
- mobile/src/components/TerminalShortcutSettings.tsx
- mobile/app/_layout.tsx
- src/shared/runtime-types.ts
- mobile/src/terminal/terminal-ios-ime-keyboard.test.ts
- mobile/src/terminal/terminal-hardware-key.ts
- mobile/app/terminal-settings.tsx
- mobile/packages/expo-hardware-keyboard/android/src/main/java/expo/modules/hardwarekeyboard/OrcaKeyCaptureView.kt
- mobile/src/theme/theme-context.tsx
- mobile/app/h/[hostId]/session/[worktreeId].tsx
- mobile/packages/expo-hardware-keyboard/ios/ExpoHardwareKeyboard.podspec
Expose the appearance radio's checked state via accessibilityState.checked instead of selected, per React Native's accessibility contract for accessibilityRole="radio". Scope the display-verify harness doc to the JS/TS/CSS effort it actually covers, since this PR now also ships the native expo-hardware-keyboard module. Trim two comments that only restated adjacent code.
…keyboard-capture # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx # mobile/pnpm-lock.yaml # mobile/src/ime/ime-submit-carry.test.ts # mobile/src/terminal/terminal-input-connection-gate.test.ts # mobile/src/terminal/terminal-ios-dictation-write-back.test.ts
|
@AmethystLiang what do you guys need for this |
…keyboard-capture # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx
On mobile clients like iPad, a physical keyboard would not register all the keys and only accepted character inputs before. This PR updates the text input layer to accept non-character keys so that the macros, etc. can be used.
Notably, this fix doesn't yet yield a 100% keyboard pass through. Doing so would potentially require a bigger refactor which I did not want to throw out unprompted. If it is of interest, consider refactoring the input layer to utilize the Kitty Key protocol or similar to getter generalize input device passthrough to the underlying terminal UI.
Summary
RN's
TextInputonly surfaces printable characters and Backspace on iOS, so aphysical Ctrl, Alt, arrow, Esc, Tab, or function key produced no JS event and
never reached the PTY — a hardware keyboard attached to an iPad could only
type text, nothing else.
expo-hardware-keyboardnative module (iOS Swift + Android Kotlin)that captures raw hardware key presses and forwards
{key, modifiers}toJS, reusing the existing
buildTerminalShortcutKey()byte encoding andsendLiveTerminalInput()delivery path.rather than a separate mode: with a hardware keyboard attached (detected via
isHardwareKeyboardConnected(), polled while live input is on since there'sno attach/detach push event), live input mounts the native capture view and
never raises the software keyboard; without one it falls back to the
existing
TextInputpath exactly as before.Device fixes
Three interception bugs only reproduced on a real iPad, not the simulator —
each is documented with a
// Why:comment at its fix site inOrcaKeyCaptureView.swift:navigation system separate from the responder chain — was claiming them
first. Fixed by opting into
canBecomeFocusedand driving it explicitly.ancestor responders (field navigation,
UIScrollView's built-inhardware-keyboard scrolling). Fixed by claiming them as explicit
UIKeyCommands so this view wins resolution first.ctrlKey: false. Same fix — explicitUIKeyCommands for the shell-relevant combos (^C ^D ^L ^Z ^R ^A ^E ^W ^U).Known follow-ups (not fixed here)
tried and pulled back out: on-device behavior didn't match what it was
written to produce, and something already appears to generate repeat
invocations at a ~150-200ms cadence without any special handling here —
stacking a second repeat source on top risked over-repeating rather than
fixing anything. Needs an attached debugger to diagnose properly rather
than remote log scraping.
Right now Enter and Shift+Enter both produce
\r— this matches standardterminal behavior (Terminal.app, iTerm) but means a terminal app that wants
to disambiguate them (e.g. Shift+Enter for a literal newline) can't. The
proper fix is a separate, larger feature: a keyboard-passthrough protocol
that reports precise key-down/up and modifier state to the far end instead
of collapsing everything to control bytes. Worth exploring on its own; out
of scope here.
How to verify
Tested hands-on on a real iPad (simulator does not exercise a hardware
keyboard) with a physical keyboard attached:
and back to the software-keyboard path when it's detached — no separate
toggle to manage.
Ctrl+<letter>shortcuts (^C,^D,^L,^Z,^R,^A,^E,^W,^U) all work at a real shell prompt.npx tsc --noEmit,npx oxlint,npx oxfmt --check,node config/scripts/check-max-lines-ratchet.mjs,npx vitest run(352 files / 2592 tests) — all clean.
Not covered: Android (module ships a Kotlin implementation mirroring the iOS
logic but wasn't hands-on tested this round), and the two follow-ups above.
ELI5
On iPad with a hardware keyboard, only normal typing and Backspace reached the mobile terminal—Ctrl, arrows, Esc, Tab, and function keys did nothing. This adds a native module so physical special keys work in terminal sessions.