# claudette-mobile

The Claudette iOS / Android client. Thin WSS remote-control app — it pairs with a running Claudette desktop or headless `claudette-server` and drives chat sessions over the same wire protocol the desktop's Remote Workspaces feature uses.

## Status

iOS foundation work, Phase 5+. The Rust side ships the pair / connect / list / forget surface plus a generic `send_rpc` JSON-RPC passthrough and an event-forwarder that re-emits server events to the webview. The mobile webview frontend lives at `src/ui-mobile/` and has the connect, workspace-list, and chat screens.

## Setup (iOS, one-time)

Tauri 2's iOS support uses Apple's toolchain, so device builds require:

1. **macOS** with [Xcode](https://developer.apple.com/xcode/) installed (Xcode 15+ recommended).
2. An [Apple Developer Program](https://developer.apple.com/programs/) account if you want to deploy to a physical iPhone (free account works for the simulator and ad-hoc on-device testing for 7 days).
3. The iOS Rust targets:
   ```bash
   rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
   ```
4. The Xcode project scaffolding, generated by Tauri:
   ```bash
   cd src-mobile
   cargo tauri ios init
   ```
   This creates `src-mobile/gen/apple/` containing the Xcode project, Swift wrapper, and `Info.plist`. `gen/` is gitignored and not in the repo — generate it locally on first run. When you regenerate, prefer `cargo tauri ios init --reinstall` so existing customizations (signing identity, capabilities) survive.

## Running

```bash
# iOS simulator (camera-less; use the Advanced/paste fallback for pair tests):
cargo tauri ios dev

# Physical device (requires Apple Developer signing identity):
cargo tauri ios dev --host

# Desktop fallback for fast UI iteration (no Xcode needed):
cargo tauri dev --bin claudette-mobile
```

The desktop fallback boots the same webview in a 390×844 window so you can iterate on the mobile UI without an Xcode round-trip. It's not a substitute for on-device testing (camera, Keychain, safe-area insets all behave differently) but it's much faster for layout work.

## Workspace layout

| Path | What's there |
|---|---|
| `Cargo.toml` | Crate manifest. Depends on `claudette` with `default-features = false` so the agent runtime / Pi sidecar / heavy bits stay out of the mobile binary. |
| `build.rs` | `tauri-build` invocation. |
| `src/lib.rs` | Tauri runtime entry. The `#[tauri::mobile_entry_point]` macro exposes a FFI symbol the Swift / JNI wrappers launch. |
| `src/main.rs` | Desktop-fallback entry point — `cargo tauri dev --bin claudette-mobile`. |
| `src/state.rs` | `ConnectionManager` holding active `Transport` instances per paired server. |
| `src/storage.rs` | Persistence for paired-server records (`SavedConnection`) in the app data dir. |
| `src/commands.rs` | Tauri-invokable commands — `version`, `pair_with_connection_string`, `list_saved_connections`, `connect_saved`, `send_rpc`, `forget_connection`, plus the per-connection event forwarder. |
| `tauri.conf.json` | Tauri config — bundle identifier `dev.claudette.mobile`, iOS minimum version 16.0. Frontend dist is `../src/ui-mobile/dist`, dev server on port 14254. |
| `capabilities/default.json` | Core webview permission manifest — grants `core:default`. |
| `capabilities/mobile.json` | Mobile-only (iOS / Android) permissions — grants `barcode-scanner:default` for QR pairing. Split out so the desktop-fallback build still compiles without the mobile-only plugin. |
| `icons/` | App icon. Seeded from the desktop `src-tauri/icons/icon.png`; replace with mobile-specific art when ready. |
| `gen/apple/` | **Not in git** (`gen/` is gitignored). Generated by `cargo tauri ios init` — regenerate locally on each machine. |

The mobile webview frontend is a separate Vite project at `src/ui-mobile/` (React/TypeScript), built into `src/ui-mobile/dist/` and loaded by the Tauri config above.

## What does NOT run on the phone

Spelled out in detail in [`site/src/content/docs/features/mobile-app.mdx`](../site/src/content/docs/features/mobile-app.mdx), but the short version:

- No `claude` subprocess. The phone is a WSS client; agents run on the paired host.
- No SQLite. Workspace metadata is fetched from the host on each session.
- No Git, no PTY, no MCP servers, no voice. All of those are desktop / server features.

This makes the mobile binary fundamentally small and lets the Rust side share the `claudette` lib's `transport` and `model` modules without dragging in the rest of the agent stack.
