Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 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
1e52e2c
Add host update settings to OX Mobile
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
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
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
1a2fb9a
Keep mobile host setup independent of QR changes
n0rpan Nov 29, 2026
2317c64
Keep sign-in state separate from iPhone alerts
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
90 changes: 90 additions & 0 deletions desktop/ox-host-web/src/terminal_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,46 @@ pub fn size_allowed(rows: u16, cols: u16) -> bool {
(MIN_ROWS..=MAX_ROWS).contains(&rows) && (MIN_COLS..=MAX_COLS).contains(&cols)
}

/// The stock ChatGPT device sign-in page, when the terminal shows it.
///
/// `codex login --device-auth` prints `https://auth.openai.com/codex/device`
/// and the one-time code separately (verified against codex-cli 0.172.0 and
/// OpenAI's [headless login documentation](https://learn.chatgpt.com/docs/auth)).
/// The phone may hand this exact page to the system browser after a tap, so
/// every other URL that happens to appear in the output is ignored: a
/// look-alike host, a port, credentials, a different path or any query is
/// not the stock page.
pub fn codex_device_url(screen: &str) -> Option<String> {
screen.split_ascii_whitespace().find_map(|candidate| {
let end = candidate
.find(['<', '>', '"', '\''])
.unwrap_or(candidate.len());
let url = url::Url::parse(candidate.get(..end)?).ok()?;
(url.scheme() == "https"
&& url.host_str() == Some("auth.openai.com")
&& url.port().is_none()
&& url.path() == "/codex/device"
&& url.username().is_empty()
&& url.password().is_none()
&& url.query().is_none()
&& url.fragment().is_none())
.then(|| url.to_string())
})
}

/// Read the code on the line following the stock Codex device prompt.
pub fn codex_device_code(screen: &str) -> Option<&str> {
let mut lines = screen.lines();
lines.find(|line| line.contains("Enter this one-time code"))?;
let code = lines.map(str::trim).find(|line| !line.is_empty())?;
((6..=32).contains(&code.len())
&& code.contains('-')
&& code
.split('-')
.all(|part| !part.is_empty() && part.bytes().all(|byte| byte.is_ascii_alphanumeric())))
.then_some(code)
}

#[derive(Serialize)]
#[serde(tag = "preset", rename_all = "kebab-case")]
pub enum OpenTerminal {
Expand Down Expand Up @@ -199,4 +239,54 @@ mod tests {
assert!(!size_allowed(MIN_ROWS, MIN_COLS - 1));
assert!(!size_allowed(MAX_ROWS, MAX_COLS + 1));
}

#[test]
fn only_the_stock_codex_device_page_is_opened() {
let stock = "\
Follow these steps to sign in with ChatGPT using device code authorization:
1. Open this link in your browser and sign in to your account
https://auth.openai.com/codex/device
2. Enter this one-time code
ABCD-1234
(expires in 15 minutes)";
assert_eq!(
codex_device_url(stock).as_deref(),
Some("https://auth.openai.com/codex/device")
);
// The host may also hand the complete line over on its own.
assert_eq!(
codex_device_url("https://auth.openai.com/codex/device").as_deref(),
Some("https://auth.openai.com/codex/device")
);
// A screen without the exact stock page yields no link at all, so
// nothing else the program prints can reach the browser.
for screen in [
"no link here",
"https://auth.openai.com.evil.test/codex/device",
"http://auth.openai.com/codex/device",
"https://[email protected]/codex/device",
"https://auth.openai.com:8443/codex/device",
"https://auth.openai.com/codex/device/extra",
"https://auth.openai.com/codex/device?next=https://evil.test",
"https://evil.test/?next=https://auth.openai.com/codex/device",
"https://chatgpt.com/codex/device",
"https://accounts.google.com/o/oauth2/auth?client_id=x",
] {
assert_eq!(codex_device_url(screen), None, "{screen}");
}
}
#[test]
fn device_code_requires_the_stock_prompt_and_a_code_shaped_line() {
assert_eq!(
codex_device_code(
"2. Enter this one-time code (expires in 15 minutes)\n ABCD-EFGH-1234 "
),
Some("ABCD-EFGH-1234")
);
assert_eq!(codex_device_code("ABCD-EFGH-1234"), None);
assert_eq!(
codex_device_code("Enter this one-time code\nhttps://example.test/token"),
None
);
}
}
16 changes: 16 additions & 0 deletions desktop/ox-mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ dismiss the keyboard. In a conversation, Return inserts a line break and
Command-Return submits from a hardware keyboard.
[Verification.txt](Verification.txt) records the original Linux and vphone checks.

## Sign in to ChatGPT from the phone

**Settings → Sign in with ChatGPT** opens the host's stock
`ox login chatgpt --device-auth` terminal: the phone shows the reviewed
command and folder, starts nothing until you tap Run, then shows the printed
device page and one-time code. After a tap it opens only
`https://auth.openai.com/codex/device` in the system browser. The app keeps
the terminal output in memory only while the process runs, discards it when
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.

## Live Activity prototype (experimental, opt-in)

[`live-activity/`](live-activity/) is a private WidgetKit/ActivityKit
Expand Down
55 changes: 52 additions & 3 deletions desktop/ox-mobile/src/mobile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ enum Screen {
Conversation,
Handoff,
Settings,
ChatGpt,
Updates,
Running,
InputTest,
Expand Down Expand Up @@ -101,6 +102,10 @@ pub(crate) struct Mobile {
question_fields: Option<(ReviewedAsk, Vec<Entity<InputState>>)>,
question_subscriptions: Vec<Subscription>,
_subscriptions: Vec<Subscription>,
account: Account,
terminal: Option<TerminalAccess>,
login: Option<ChatGptLogin>,
status: Option<Task<()>>,
pub(crate) client: Option<PairedClient>,
pub(crate) origin: String,
pub(crate) updates: updates::Updates,
Expand Down Expand Up @@ -134,6 +139,10 @@ pub(crate) struct Mobile {
_keyboard_events: Option<Task<()>>,
}

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

impl Mobile {
pub(crate) fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let address =
Expand Down Expand Up @@ -229,6 +238,10 @@ impl Mobile {
question_fields: None,
question_subscriptions: Vec::new(),
_subscriptions: subscriptions,
account: Account::default(),
terminal: None,
login: None,
status: None,
client: None,
origin: String::new(),
updates: updates::Updates::default(),
Expand Down Expand Up @@ -453,6 +466,11 @@ impl Mobile {
let returning_to_conversation =
self.screen == Screen::Handoff && screen == Screen::Conversation;
window.blur(cx);
if screen != Screen::ChatGpt {
// 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;
}
// An update reply belongs to the screen that asked. Leaving it drops
// the wait, and coming back asks the host again.
if self.screen == Screen::Updates && screen != Screen::Updates {
Expand Down Expand Up @@ -1208,6 +1226,9 @@ impl Mobile {
Ok(warning) => {
app.catalog.stop();
app.client = None;
app.account = Account::default();
app.terminal = None;
app.status = None;
app.updates.reset();
app.running.reset();
app.session = None;
Expand Down Expand Up @@ -1269,6 +1290,7 @@ impl Render for Mobile {
Screen::Conversation => ("Conversation", Some(Screen::Sessions)),
Screen::Handoff => ("Continue in…", Some(Screen::Conversation)),
Screen::Settings => ("Host settings", Some(Screen::Projects)),
Screen::ChatGpt => ("Sign in to ChatGPT", Some(Screen::Settings)),
Screen::Updates => ("Host updates", Some(Screen::Settings)),
Screen::Running => ("Running processes", Some(Screen::Settings)),
Screen::InputTest => ("Input test", Some(self.before_test)),
Expand All @@ -1291,9 +1313,12 @@ impl Render for Mobile {
.child(title),
)
.when(self.screen == Screen::Projects, |header| {
header.child(button("settings", "Settings").on_click(
cx.listener(|app, _, window, cx| app.navigate(Screen::Settings, window, cx)),
))
header.child(button("settings", "Settings").on_click(cx.listener(
|app, _, window, cx| {
app.navigate(Screen::Settings, window, cx);
app.refresh_sign_in_status(window, cx);
},
)))
});
let body: AnyElement = match self.screen {
Screen::Pair => self.pair_screen(cx).into_any_element(),
Expand All @@ -1305,6 +1330,7 @@ impl Render for Mobile {
Screen::Conversation => self.conversation(cx).into_any_element(),
Screen::Handoff => self.handoff_screen(cx).into_any_element(),
Screen::Settings => self.settings_screen(cx).into_any_element(),
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::InputTest => self
Expand Down Expand Up @@ -1664,6 +1690,29 @@ impl Mobile {
fn settings_screen(&self, cx: &mut Context<Self>) -> impl IntoElement {
scroll("host-settings")
.child(self.origin.clone())
.child(
column()
.p_2()
.rounded_md()
.bg(cx.theme().secondary)
.child(
div()
.font_weight(gpui::FontWeight::SEMIBOLD)
.child("ChatGPT"),
)
.child(div().text_sm().child(self.chatgpt_status()))
.child(
button("chatgpt-sign-in", "Sign in with ChatGPT")
.primary()
.on_click(cx.listener(|app, _, window, cx| {
app.navigate(Screen::ChatGpt, window, cx);
app.refresh_sign_in_status(window, cx);
})),
)
.child(button("refresh-chatgpt", "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
55 changes: 54 additions & 1 deletion desktop/ox-mobile/src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ use ox_desk_core::{
runtime::Route,
store::{Store, replica::ReplicaTransport},
};
use ox_host_web::client::{self, Credential, Invitation, PairedClient};
use ox_host_web::{
client::{self, Credential, Invitation, Operator, PairedClient},
terminal_protocol::OpenTerminal,
};
use serde::Deserialize;
use serde_json::json;
use std::{
io::{self, BufReader},
net::Shutdown,
Expand Down Expand Up @@ -61,6 +65,55 @@ pub(crate) struct Directory {
pub routes: Vec<Route>,
}

/// What the host says about its ChatGPT sign-in and this device's terminal grant.
pub(crate) struct SignInStatus {
/// The host's saved Codex account, from the settings `ReadRows` snapshot.
pub account: Option<String>,
/// Why the snapshot could not be read, once the device facts were known.
pub account_error: Option<String>,
pub terminal: bool,
/// This device's ID, as the host names it in `ox host devices`.
pub device: Option<String>,
}

pub(crate) fn sign_in_status(client: PairedClient) -> io::Result<SignInStatus> {
let runtime = client::runtime()?;
runtime.block_on(async {
let devices = client.settings(json!({"action":"devices"})).await?;
let device = devices["self"].as_str().map(str::to_owned);
let terminal = device.as_deref().is_some_and(|id| {
devices["devices"].as_array().is_some_and(|rows| {
rows.iter().any(|row| {
row["id"].as_str() == Some(id) && row["terminal"].as_bool() == Some(true)
})
})
});
// The grant decides whether the sign-in can start, so an unreadable
// account snapshot is reported without discarding it.
let (account, account_error) = match client.settings(json!({"action":"read_rows"})).await {
Ok(rows) => (rows["chatgpt_account"].as_str().map(str::to_owned), None),
Err(error) => (None, Some(error.to_string())),
};
Ok(SignInStatus {
account,
account_error,
terminal,
device,
})
})
}

pub(crate) fn chatgpt_account(client: PairedClient) -> io::Result<Option<String>> {
let runtime = client::runtime()?;
let rows = runtime.block_on(client.settings(json!({"action":"read_rows"})))?;
Ok(rows["chatgpt_account"].as_str().map(str::to_owned))
}

pub(crate) fn codex_login(client: PairedClient) -> io::Result<Operator> {
let runtime = client::runtime()?;
runtime.block_on(client.operator(OpenTerminal::CodexLogin))
}

/// One page of the host's new-project picker, as `browse_folders` answers it.
#[derive(Debug, Deserialize)]
pub(crate) struct Folders {
Expand Down
Loading
Loading