Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a7345d6
Share the native host session transport with mobile
n0rpan Nov 28, 2026
e1326ae
Land the native mobile app and TestFlight delivery from main
n0rpan Nov 28, 2026
116f512
Page mobile conversations and find the Android SDK in CI
n0rpan Nov 28, 2026
d93c3f2
Start ADB before booting the Android CI emulator
n0rpan Nov 28, 2026
6681d36
Set a shared AVD directory for Android CI
n0rpan Nov 28, 2026
3172630
Scan pairing QR codes natively on iOS
n0rpan Nov 28, 2026
c0155cc
Use a UIKit message composer on iPhone
n0rpan Nov 28, 2026
45d5c95
Validate scanned invitations with the shared pairing parser
n0rpan Nov 28, 2026
1a32075
Build the QR scanner with the native iPhone composer
n0rpan Nov 28, 2026
64f6f1e
Verify native editor layout in the iPhone simulator
n0rpan Nov 28, 2026
61e0d73
Use LavaPipe for the Android emulator smoke check
n0rpan Nov 28, 2026
acf147e
Merge remote-tracking branch 'origin/mobile/native-composer' into mob…
n0rpan Nov 28, 2026
9bbeb1d
Make QR the primary iPhone pairing action
n0rpan Nov 28, 2026
626cc53
Add a typed operator session to the paired client
n0rpan Nov 28, 2026
d21b911
Isolate the iPhone simulator device set in CI
n0rpan Nov 28, 2026
b183797
Test the native editor in the isolated iPhone simulator
n0rpan Nov 28, 2026
799943e
Carry the isolated simulator and Android launch fixes into the QR beta
n0rpan Nov 28, 2026
2bbf4b2
Keep mobile drafts and make approval questions usable
n0rpan Nov 28, 2026
654f5bc
Sign in to a headless Codex host from OX Mobile
n0rpan Nov 28, 2026
fc3a933
Capture the primary display in the iPhone launch check
n0rpan Nov 28, 2026
135ba94
Use the primary simulator display for both native editor checks
n0rpan Nov 28, 2026
125946b
Use single-display screenshots in the QR beta simulator
n0rpan Nov 28, 2026
6e34cc5
Merge remote-tracking branch 'origin/main' into mobile/native-app
n0rpan Nov 28, 2026
b50800f
Let mobile reconnect when the runtime needs sign-in
n0rpan Nov 28, 2026
d211b17
Sign in to Claude Code from OX Mobile
n0rpan Nov 28, 2026
d9fcdb9
Accept the current stock Claude authorization endpoint
n0rpan Nov 28, 2026
1e52e2c
Add host update settings to OX Mobile
n0rpan Nov 28, 2026
e7daead
Keep host-captured sign-in URLs intact
n0rpan Nov 28, 2026
b5b2e17
Keep the update controller off mobile targets
n0rpan Nov 28, 2026
aae4514
Bring the typed operator client onto main
n0rpan Nov 28, 2026
8a6b663
Add host update settings to OX Mobile
n0rpan Nov 28, 2026
a29aa07
Keep the update controller off mobile targets
n0rpan Nov 28, 2026
9b130b6
Reconcile host update settings with the released mobile base
n0rpan Nov 29, 2026
cbf4c85
Sign in to a headless Codex host from OX Mobile
n0rpan Nov 28, 2026
170628d
Reconcile Codex device sign-in with the reviewed operator client
n0rpan Nov 29, 2026
40424b7
Sign in to Claude Code from OX Mobile
n0rpan Nov 28, 2026
8893114
Accept the current stock Claude authorization endpoint
n0rpan Nov 28, 2026
d57372b
Keep host-captured sign-in URLs intact
n0rpan Nov 28, 2026
1ce2f0b
Reconcile Claude sign-in with the reviewed Codex sign-in base
n0rpan Nov 29, 2026
1f69b04
Reconcile host updates with the merged project picker
n0rpan Nov 29, 2026
1006e5c
Keep host update and approval lookup tests together
n0rpan Nov 29, 2026
868052c
Keep the mobile updates UI out of desktop-side tests
n0rpan Nov 29, 2026
08418a9
Run the mobile Rust unit tests in the Android CI job
n0rpan Nov 29, 2026
e79bf9f
Keep host updates alongside the merged UIKit composer
n0rpan Nov 29, 2026
32b9b24
Keep Codex sign-in alongside the merged mobile foundations
n0rpan Nov 29, 2026
0036028
Reconcile the iOS QR pairing feature onto the native composer
n0rpan Nov 29, 2026
624ff9f
Merge commit '32b9b24' into mobile/claude-sign-in-reconciled
n0rpan Nov 29, 2026
58e93a4
Keep iPhone camera pairing alongside host updates
n0rpan Nov 29, 2026
f1e46c4
Merge commit 'cb5e59a' into mobile/ios-qr-after-host-updates
n0rpan Nov 29, 2026
e1fe01d
Preserve Android keyboard insets beside the iPhone camera callback
n0rpan Nov 29, 2026
c2a8bbe
Keep Live Sessions when configuring iPhone QR events
n0rpan Nov 29, 2026
fca3648
Keep QR camera linkage compatible with the activity bridge
n0rpan Nov 29, 2026
4a3c1e8
Reconcile Codex sign-in with the mobile foundations (#101)
n0rpan Nov 29, 2026
5edc5d9
Keep Claude sign-in alongside current Codex and QR pairing
n0rpan Nov 29, 2026
2c070df
Merge origin/main (d608902) into the Claude sign-in branch
n0rpan Nov 29, 2026
29680a4
Merge remote-tracking branch 'origin/main' into mobile/claude-sign-in…
n0rpan Nov 29, 2026
92e9b24
Merge remote-tracking branch 'origin/main' into mobile/claude-sign-in…
n0rpan Nov 29, 2026
ec6f3b6
Keep the Claude sign-in route independent of device management
n0rpan Nov 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions desktop/ox-host-web/assets/operator.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ export async function openPhoneTerminal(
screen.textContent = f.screen;
screen.scrollTop = screen.scrollHeight;
if (nativeLogin) {
// Antigravity prints a long OAuth URL. The host supplies the complete
// line separately from the terminal's wrapped screen.
const candidates = antigravityLogin
? [f.login_url]
: f.screen.match(/https:\/\/[^\s<>"']+/g) ?? [];
// The host supplies OAuth URLs that may wrap in the terminal view.
const link = el("operator-link");
const fromScreen = !antigravityLogin && !link.hasAttribute("href")
? f.screen.match(/https:\/\/[^\s<>"']+/g) ?? []
: [];
const candidates = [f.login_url, ...fromScreen];
for (const candidate of candidates) {
if (typeof candidate !== "string") continue;
let url;
Expand All @@ -252,14 +253,15 @@ export async function openPhoneTerminal(
? url.origin === "https://accounts.google.com" &&
["/o/oauth2/v2/auth", "/o/oauth2/auth"].includes(url.pathname) &&
url.search && !url.hash
: [
: (url.origin === "https://claude.com" &&
url.pathname === "/cai/oauth/authorize") || [
"https://claude.ai",
"https://platform.claude.com",
"https://console.anthropic.com",
].includes(url.origin) && url.pathname.includes("/oauth/");
if (native && !url.username && !url.password) {
el("operator-link").href = antigravityLogin ? candidate : url.href;
el("operator-link").hidden = false;
link.href = antigravityLogin ? candidate : url.href;
link.hidden = false;
break;
}
}
Expand Down
11 changes: 11 additions & 0 deletions desktop/ox-host-web/src/client/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ fn native_desktop() {
rt.block_on(operator.next()),
Some(Event::Exit { exit: Some(0) })
) {}
// The Claude sign-in reaches the same signed operator and host review.
// Dropping it after the preview starts no process and leaves the grant
// untouched.
let claude = rt
.block_on(client.operator(OpenTerminal::ClaudeLogin))
.unwrap();
let Some(Event::Review { review, .. }) = rt.block_on(claude.next()) else {
panic!("expected the Claude sign-in review");
};
assert!(review.ends_with("login claude"), "{review}");
drop(claude);
rt.block_on(client.revoke_self()).unwrap();
assert!(rt.block_on(client.session()).is_err());
credential.discard_key().unwrap();
Expand Down
18 changes: 15 additions & 3 deletions desktop/ox-host-web/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ enum Preset {
AntigravityLogin,
NativeSession,
}
use crate::terminal_protocol::{Input, MAX_FRAME_BYTES, MAX_KEY_BYTES, size_allowed};
use crate::terminal_protocol::{
Input, MAX_FRAME_BYTES, MAX_KEY_BYTES, claude_login_url, size_allowed,
};
async fn send(ws: &mut WebSocket, v: Value) -> bool {
matches!(
timeout(
Expand Down Expand Up @@ -93,6 +95,13 @@ fn google_login_url(line: &str) -> bool {
})
}

/// The stock Claude Code login prints the page on its own line, or after a
/// short "visit:" prefix. Capture the complete line so terminal wrapping
/// cannot hand the phone a truncated OAuth address.
fn claude_login_line(line: &str) -> bool {
claude_login_url(line).is_some()
}

async fn project(app: &App, requested: Option<&Path>) -> Option<PathBuf> {
let Some(path) = requested else {
return std::env::var_os("HOME")
Expand Down Expand Up @@ -149,8 +158,11 @@ async fn operator(app: App, id: String, mut ws: WebSocket) {
return;
};
let mut lease = None;
let login_matcher = matches!(request.preset, Preset::AntigravityLogin)
.then(|| Box::new(google_login_url) as ox_pty::LineMatcher);
let login_matcher = match request.preset {
Preset::AntigravityLogin => Some(Box::new(google_login_url) as ox_pty::LineMatcher),
Preset::ClaudeLogin => Some(Box::new(claude_login_line) as ox_pty::LineMatcher),
_ => None,
};
let (cwd, mut cmd) = match request.preset {
Preset::NativeSession => {
let (Some(scope), Some(thread), None) =
Expand Down
160 changes: 160 additions & 0 deletions desktop/ox-host-web/src/terminal_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,56 @@ pub fn codex_device_code(screen: &str) -> Option<&str> {
.then_some(code)
}

/// The stock Claude Code sign-in page, when the terminal shows it.
///
/// `claude auth login --claudeai` prints the page on its own line or after a
/// short "visit:" prefix. Keep the provider's existing OAuth origins and
/// the exact `/cai/oauth/authorize` endpoint on `claude.com` used by stock
/// Claude Code. Keep the same rules in the browser operator.
pub fn claude_login_url(text: &str) -> Option<String> {
text.split_ascii_whitespace().find_map(|candidate| {
let end = candidate
.find(['<', '>', '"', '\''])
.unwrap_or(candidate.len());
let candidate = candidate.get(..end)?;
if !candidate.starts_with("https://") {
return None;
}
let url = url::Url::parse(candidate).ok()?;
let official = match url.host_str() {
Some("claude.ai" | "platform.claude.com" | "console.anthropic.com") => {
url.path().contains("/oauth/")
}
Some("claude.com") => url.path() == "/cai/oauth/authorize",
_ => false,
};
(official && url.port().is_none() && url.username().is_empty() && url.password().is_none())
.then(|| url.to_string())
})
}

/// A host-captured line can replace a screen fallback. Later terminal frames
/// may contain a wrapped copy and cannot replace the URL already captured.
pub fn capture_login_url(
parse: fn(&str) -> Option<String>,
has_url: bool,
host_line: Option<&str>,
screen: &str,
) -> Option<String> {
host_line
.and_then(parse)
.or_else(|| if has_url { None } else { parse(screen) })
}

/// The code or redirect URL pasted at the stock Claude prompt, when it is
/// text a single terminal line can receive. The caller sends it once and
/// then drops it; this function never stores or reports a value.
pub fn claude_auth_code(text: &str) -> Option<&str> {
let code = text.trim();
(!code.is_empty() && code.len() < MAX_KEY_BYTES && !code.chars().any(char::is_control))
.then_some(code)
}

#[derive(Serialize)]
#[serde(tag = "preset", rename_all = "kebab-case")]
pub enum OpenTerminal {
Expand Down Expand Up @@ -289,4 +339,114 @@ Follow these steps to sign in with ChatGPT using device code authorization:
None
);
}

#[test]
fn only_the_official_claude_sign_in_pages_are_opened() {
let stock = "\
Opening your browser to sign in.
If the browser didn't open, visit:
https://platform.claude.com/oauth/authorize?code=true&client_id=fixture&state=fixture
Paste code here if prompted > ";
assert_eq!(
claude_login_url(stock).as_deref(),
Some(
"https://platform.claude.com/oauth/authorize?code=true&client_id=fixture&state=fixture"
)
);
for (text, expected) in [
(
"Browser didn't open? Visit: https://claude.ai/oauth/authorize?code=true&client_id=x",
Some("https://claude.ai/oauth/authorize?code=true&client_id=x"),
),
(
"https://console.anthropic.com/oauth/authorize?code=true&client_id=x",
Some("https://console.anthropic.com/oauth/authorize?code=true&client_id=x"),
),
// The browser operator checks the origin and a `/oauth/` path, not
// one exact pathname.
(
"https://claude.ai/v1/oauth/authorize?code=true",
Some("https://claude.ai/v1/oauth/authorize?code=true"),
),
// A different host, scheme, port, credentials or path is not the
// stock page and never reaches the system browser.
("http://claude.ai/oauth/authorize?code=true", None),
(
"https://claude.ai.evil.test/oauth/authorize?code=true",
None,
),
("https://[email protected]/oauth/authorize?code=true", None),
("https://claude.ai:8443/oauth/authorize?code=true", None),
("https://claude.ai/not-oauth/authorize?code=true", None),
(
"https://claude.com/cai/oauth/authorize?client_id=fixture&state=fixture",
Some("https://claude.com/cai/oauth/authorize?client_id=fixture&state=fixture"),
),
("https://claude.com/other/oauth/authorize?code=true", None),
(
"https://[email protected]/cai/oauth/authorize?code=true",
None,
),
("https:claude.ai/oauth/authorize?code=true", None),
(
"https://evil.test/?next=https://claude.ai/oauth/authorize",
None,
),
("https://", None),
("no link here", None),
] {
assert_eq!(claude_login_url(text).as_deref(), expected, "{text}");
}
}

#[test]
fn wrapped_terminal_frames_cannot_replace_the_host_captured_page() {
let complete = "https://claude.com/cai/oauth/authorize?client_id=fixture&state=long-state";
let wrapped = "https://claude.com/cai/oauth/authorize?client_id=fix\nture&state=long-state";
assert!(capture_login_url(claude_login_url, false, None, wrapped).is_some());
assert_eq!(
capture_login_url(claude_login_url, true, Some(complete), wrapped).as_deref(),
Some(complete),
);
assert_eq!(
capture_login_url(claude_login_url, true, None, wrapped),
None
);
}

#[test]
fn a_pasted_claude_code_is_one_printable_line_inside_the_input_bound() {
assert_eq!(claude_auth_code(" fixture-code\n"), Some("fixture-code"));
assert_eq!(
claude_auth_code("https://claude.ai/oauth/authorize?code=fixture&state=fixture"),
Some("https://claude.ai/oauth/authorize?code=fixture&state=fixture")
);
assert_eq!(claude_auth_code(" "), None);
assert_eq!(claude_auth_code("one\ntwo"), None);
assert_eq!(claude_auth_code("code\rvalue"), None);
// One byte of the host's input bound is left for the line ending the
// caller appends, so the terminal receives the whole code.
let longest = "x".repeat(MAX_KEY_BYTES - 1);
assert_eq!(claude_auth_code(&longest), Some(longest.as_str()));
assert_eq!(claude_auth_code(&"x".repeat(MAX_KEY_BYTES)), None);
}

#[test]
fn login_presets_are_the_ones_the_host_accepts() {
for (terminal, preset) in [
(OpenTerminal::CodexLogin, "codex-login"),
(OpenTerminal::ClaudeLogin, "claude-login"),
(OpenTerminal::AntigravityLogin, "antigravity-login"),
] {
assert_eq!(
serde_json::to_value(terminal).unwrap(),
json!({"preset": preset})
);
}
assert_eq!(
serde_json::to_value(OpenTerminal::login(ox_desk_core::runtime::Runtime::Claude))
.unwrap(),
json!({"preset":"claude-login"})
);
}
}
15 changes: 13 additions & 2 deletions desktop/ox-mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,19 @@ the process exits, and then reads the host's saved account again.
The device needs terminal access: allow it in **OX Desktop → Settings →
Remote access**, or on a headless host run `ox host devices` and then
`ox host terminal <device> on`. Device-code sign-in also has to be enabled in
the ChatGPT account's security settings or workspace permissions. Claude,
Antigravity and a general terminal are later changes.
the ChatGPT account's security settings or workspace permissions. Antigravity
and a general terminal are later changes.

**Settings → Sign in with Claude** does the same for the host's stock
`ox login claude`: review the command, tap Run, then open only the official
Claude sign-in page the terminal printed. The phone accepts the same page as
the browser operator. It uses HTTPS with a `/oauth/` path on `claude.ai`,
`platform.claude.com` or `console.anthropic.com`, or the stock endpoint
`https://claude.com/cai/oauth/authorize`. When Claude Code asks for a
code, paste it into the masked field; it is cleared when sent, when you go
back and when the sign-in restarts. The terminal output, sign-in page and
pasted code stay in memory only while the process runs and are discarded when
it exits.

## Providers on the host

Expand Down
37 changes: 32 additions & 5 deletions desktop/ox-mobile/src/mobile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ enum Screen {
ChatGpt,
Updates,
Running,
Claude,
Providers,
InputTest,
}
Expand Down Expand Up @@ -145,7 +146,7 @@ pub(crate) struct Mobile {
_subscriptions: Vec<Subscription>,
account: Account,
terminal: Option<TerminalAccess>,
login: Option<ChatGptLogin>,
login: Option<SubscriptionLogin>,
status: Option<Task<()>>,
pub(crate) client: Option<PairedClient>,
pub(crate) origin: String,
Expand Down Expand Up @@ -191,7 +192,7 @@ pub(crate) struct Mobile {

#[path = "signin.rs"]
mod signin;
use signin::{Account, ChatGptLogin, TerminalAccess};
use signin::{Account, SubscriptionLogin, TerminalAccess};

impl Mobile {
pub(crate) fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
Expand Down Expand Up @@ -572,10 +573,11 @@ impl Mobile {
if self.screen == Screen::Providers && screen != Screen::Providers {
self.providers = None;
}
if screen != Screen::ChatGpt {
if !matches!(screen, Screen::ChatGpt | Screen::Claude) {
// Leaving the sign-in screen closes its operator socket, so the
// host reaps the process and no terminal output outlives the view.
self.login = None;
// host reaps the process and no terminal output or pasted code
// outlives the view.
self.cancel_login(window, cx);
}
// An update reply belongs to the screen that asked. Leaving it drops
// the wait, and coming back asks the host again.
Expand Down Expand Up @@ -1734,6 +1736,7 @@ impl Render for Mobile {
Screen::ChatGpt => ("Sign in to ChatGPT", Some(Screen::Settings)),
Screen::Updates => ("Host updates", Some(Screen::Settings)),
Screen::Running => ("Running processes", Some(Screen::Settings)),
Screen::Claude => ("Sign in to Claude Code", Some(Screen::Settings)),
Screen::Providers => ("Providers", Some(Screen::Settings)),
Screen::InputTest => ("Input test", Some(self.before_test)),
};
Expand Down Expand Up @@ -1778,6 +1781,7 @@ impl Render for Mobile {
Screen::ChatGpt => self.chatgpt_screen(cx).into_any_element(),
Screen::Updates => updates::screen(self, cx).into_any_element(),
Screen::Running => running::screen(self, cx).into_any_element(),
Screen::Claude => self.claude_screen(cx).into_any_element(),
Screen::Providers => self
.providers
.clone()
Expand Down Expand Up @@ -2200,6 +2204,29 @@ impl Mobile {
cx.listener(|app, _, window, cx| app.refresh_sign_in_status(window, cx)),
)),
)
.child(
column()
.p_2()
.rounded_md()
.bg(cx.theme().secondary)
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.child("Claude Code"),
)
.child(div().text_sm().child(self.claude_status()))
.child(
button("claude-sign-in", "Sign in with Claude")
.primary()
.on_click(cx.listener(|app, _, window, cx| {
app.navigate(Screen::Claude, window, cx);
app.refresh_sign_in_status(window, cx);
})),
)
.child(button("refresh-claude", "Refresh account").on_click(
cx.listener(|app, _, window, cx| app.refresh_sign_in_status(window, cx)),
)),
)
.child(button("host-updates", "Host updates").on_click(cx.listener(
|app, _, window, cx| {
app.navigate(Screen::Updates, window, cx);
Expand Down
Loading
Loading