clawdex-mobile 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.github/workflows/ci.yml +1 -1
  2. package/.github/workflows/npm-release.yml +18 -0
  3. package/AGENTS.md +3 -3
  4. package/README.md +104 -542
  5. package/apps/mobile/.env.example +1 -2
  6. package/apps/mobile/App.tsx +261 -68
  7. package/apps/mobile/app.json +31 -5
  8. package/apps/mobile/assets/brand/splash-icon-white.png +0 -0
  9. package/apps/mobile/eas.json +30 -0
  10. package/apps/mobile/package.json +22 -21
  11. package/apps/mobile/plugins/withAndroidCleartextTraffic.js +14 -0
  12. package/apps/mobile/src/api/__tests__/ws.test.ts +44 -6
  13. package/apps/mobile/src/api/chatMapping.ts +48 -8
  14. package/apps/mobile/src/api/client.ts +6 -0
  15. package/apps/mobile/src/api/types.ts +11 -0
  16. package/apps/mobile/src/api/ws.ts +52 -10
  17. package/apps/mobile/src/bridgeUrl.ts +105 -0
  18. package/apps/mobile/src/components/ActivityBar.tsx +32 -13
  19. package/apps/mobile/src/components/ChatHeader.tsx +3 -2
  20. package/apps/mobile/src/components/ChatInput.tsx +246 -91
  21. package/apps/mobile/src/components/ChatMessage.tsx +108 -4
  22. package/apps/mobile/src/config.ts +11 -29
  23. package/apps/mobile/src/hooks/useVoiceRecorder.ts +264 -0
  24. package/apps/mobile/src/navigation/DrawerContent.tsx +18 -8
  25. package/apps/mobile/src/screens/GitScreen.tsx +1 -1
  26. package/apps/mobile/src/screens/MainScreen.tsx +906 -268
  27. package/apps/mobile/src/screens/OnboardingScreen.tsx +1132 -0
  28. package/apps/mobile/src/screens/PrivacyScreen.tsx +1 -1
  29. package/apps/mobile/src/screens/SettingsScreen.tsx +65 -1
  30. package/apps/mobile/src/screens/TerminalScreen.tsx +1 -1
  31. package/apps/mobile/src/screens/TermsScreen.tsx +1 -1
  32. package/docs/app-review-notes.md +7 -2
  33. package/docs/eas-builds.md +91 -0
  34. package/docs/realtime-streaming-limitations.md +84 -0
  35. package/docs/setup-and-operations.md +239 -0
  36. package/docs/troubleshooting.md +121 -0
  37. package/docs/voice-transcription.md +87 -0
  38. package/package.json +8 -16
  39. package/scripts/setup-secure-dev.sh +122 -8
  40. package/scripts/setup-wizard.sh +342 -122
  41. package/scripts/start-bridge-secure.sh +7 -1
  42. package/scripts/sync-versions.js +63 -0
  43. package/services/rust-bridge/.env.example +1 -1
  44. package/services/rust-bridge/Cargo.lock +1104 -23
  45. package/services/rust-bridge/Cargo.toml +3 -1
  46. package/services/rust-bridge/package.json +1 -1
  47. package/services/rust-bridge/src/main.rs +587 -12
  48. package/apps/mobile/metro.config.js +0 -3
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Clawdex Mobile
2
2
 
3
- ![Clawdex app icon](https://raw.githubusercontent.com/Mohit-Patil/clawdex-mobile/main/apps/mobile/assets/brand/app-icon.png)
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/Mohit-Patil/clawdex-mobile/main/apps/mobile/assets/brand/app-icon.png" alt="Clawdex app icon" width="112" />
5
+ </p>
4
6
 
5
7
  Control Clawdex from your phone using an Expo React Native app (`apps/mobile`) and a Rust bridge (`services/rust-bridge`) running on your host machine.
6
8
 
@@ -8,640 +10,200 @@ This project is intended for trusted/private networking (Tailscale or local LAN)
8
10
 
9
11
  ## What You Get
10
12
 
11
- - Chat with Clawdex from mobile
12
- - Attach workspace files and phone files/images from the `+` composer menu (workspace path autocomplete included)
13
- - Switch collaboration mode per turn (`Default` / `Plan`) from the UI or slash command
14
- - Auto-promote to plan mode when plan events/structured clarifications are requested
15
- - Choose a default start directory for new chats (from existing chat workspaces)
16
- - Sidebar chats grouped by workspace as collapsible cards (latest workspace first; first group expanded by default)
17
- - Use slash commands in chat input (`/model`, `/plan`, `/new`, `/status`, `/rename`, `/compact`, `/review`, `/fork`, `/diff`, `/help`)
18
- - Select active model from an in-app model picker
19
- - Structured clarification modal (`request_user_input`) with clickable options and multi-question validation
20
- - Inline numbered-option fallback rendered as tappable choices with one-tap send
21
- - Rich approval banner actions: `Deny`, `Allow once`, `Session`, and `Allow similar` (when available)
22
- - Chat-scoped Git controls (status, commit, push)
23
- - Terminal command execution through bridge
24
- - Live thread/run updates over WebSocket
25
- - Immediate in-app loading feedback when opening a chat
26
- - Stop a running turn from the composer; stopped runs are recorded in transcript as `Turn stopped by user.`
27
- - Guided setup wizard for first-time onboarding
28
-
29
- ## Install (Quick Start)
30
-
31
- If you are using the published CLI package:
13
+ - Mobile chat with Clawdex
14
+ - Voice-to-text transcription (push-to-talk)
15
+ - Live run/activity updates over WebSocket
16
+ - Plan/default collaboration mode support
17
+ - Clarification and approval flows in-app
18
+ - File/image attachments from workspace and phone
19
+ - Chat-scoped Git actions (status/diff/commit/push)
20
+ - Bridge-backed terminal execution
21
+
22
+ ## Quick Start
23
+
24
+ ### Option A: Published CLI (recommended)
32
25
 
33
26
  ```bash
34
27
  npm install -g clawdex-mobile@latest
35
28
  clawdex init
36
29
  ```
37
30
 
38
- Recommended lifecycle:
31
+ This is the primary starting point.
32
+
33
+ `clawdex init` guides you through:
34
+
35
+ 1. bridge mode selection: `Local (LAN)` or `Tailscale`
36
+ 2. secure bridge config generation (`.env.secure`)
37
+ 3. phone readiness checks for selected mode
38
+ 4. optional bridge launch in the foreground (release build)
39
+
40
+ When the bridge starts, it prints a pairing QR:
41
+
42
+ - preferred: QR contains both `bridgeUrl + bridgeToken` (one-scan onboarding)
43
+ - fallback: token-only QR if host is not a phone-connectable address
44
+
45
+ Typical lifecycle:
39
46
 
40
47
  ```bash
41
- # 1) Install once
48
+ # install/update once
42
49
  npm install -g clawdex-mobile@latest
43
50
 
44
- # 2) Run onboarding + start bridge/Expo
51
+ # onboarding + start bridge
45
52
  clawdex init
46
53
 
47
- # 3) Scan QR in Expo Go when it appears
48
- # 4) Press Enter to detach onboarding (services keep running)
49
-
50
- # 5) Stop services later
54
+ # stop services later
51
55
  clawdex stop
52
56
  ```
53
57
 
54
- If you are running directly from this monorepo checkout:
58
+ ### Option B: Monorepo checkout
55
59
 
56
60
  ```bash
57
61
  npm install
58
62
  npm run setup:wizard
59
63
  ```
60
64
 
61
- Prerequisites are listed in `Prerequisites` below.
62
-
63
- `setup:wizard` walks through:
64
-
65
- 1. Security checkpoint
66
- 2. Prerequisite checks (with install prompts)
67
- includes: `git`, `curl`, `openssl`, C compiler/linker (`cc`), Rust/Cargo, Codex CLI, npm workspace deps (including mobile TypeScript tooling)
68
- 3. Tailscale setup on host + phone (install/login/same-network check)
69
- 4. Secure env generation/update
70
- 5. Auto-start bridge + Expo QR in the same flow (default)
71
-
72
- During step 3, the wizard now explicitly prompts you to install Tailscale on your phone, sign in, and confirm phone + host are on the same Tailscale network before proceeding.
73
- During auto-start, onboarding waits for bridge `/health` before launching Expo (first-time Rust compile may take a few minutes on fresh VPS hosts).
74
- Expo then streams live output in the terminal; press Enter to exit onboarding while bridge + Expo keep running.
75
- Installer output for Rust/npm/TypeScript is hidden by default to keep onboarding clean.
76
- Use `CLAWDEX_SETUP_VERBOSE=true clawdex init` if you want full install logs.
77
-
78
- Skip auto-start when needed:
79
-
80
- ```bash
81
- clawdex init --no-start
82
- # or from repo:
83
- npm run setup:wizard -- --no-start
84
- ```
85
-
86
- For manual setup, see `Manual Secure Setup (No Wizard)` below.
87
-
88
- ## Onboarding Output Cues
89
-
90
- After `clawdex init`, expected sequence:
91
-
92
- 1. Bridge health passes (`Bridge health check passed.`)
93
- 2. Expo starts (`Starting Expo (mobile) in background...`)
94
- 3. You may briefly see a spinner:
95
- - `Waiting for Expo output - ...`
96
- 4. Expo output begins:
97
- - `expo start --host lan`
98
- - QR block
99
- - `Metro waiting on exp://...`
100
- 5. Press Enter to detach onboarding while Expo + bridge keep running.
65
+ Use `npm run setup:wizard -- --no-start` to configure only (no bridge start).
101
66
 
102
67
  ## Project Layout
103
68
 
104
69
  - `apps/mobile`: Expo client (UI + API client)
105
70
  - `services/rust-bridge`: primary bridge (WebSocket JSON-RPC + `codex app-server` adapter)
106
71
  - `services/mac-bridge`: legacy TypeScript bridge (reference only)
107
- - `scripts/`: onboarding and runtime helper scripts
108
-
109
- ## Open Source License Requirements
110
-
111
- Follow the project-wide requirements in:
112
-
113
- - `LICENSE` (project open-source license text)
114
- - `docs/open-source-license-requirements.md`
115
-
116
- ## Realtime Behavior Notes
117
-
118
- For known realtime streaming boundaries between mobile, bridge, and standalone CLI runs (and current mitigations), see:
119
-
120
- - `docs/realtime-streaming-limitations.md`
121
-
122
- ## Branding Assets
123
-
124
- Brand files now live in:
125
-
126
- - `apps/mobile/assets/brand/app-icon.png` (Expo app icon)
127
- - `apps/mobile/assets/brand/adaptive-icon.png` (Android adaptive foreground)
128
- - `apps/mobile/assets/brand/splash-icon.png` (launch image)
129
- - `apps/mobile/assets/brand/favicon.png` (web favicon)
130
- - `apps/mobile/assets/brand/mark.png` (in-app logo mark)
131
-
132
- Expo config wiring is in `apps/mobile/app.json`.
133
- In-app brand mark component is `apps/mobile/src/components/BrandMark.tsx`.
72
+ - `scripts/`: onboarding/runtime helper scripts
73
+ - `docs/`: setup, troubleshooting, architecture notes
134
74
 
135
75
  ## Prerequisites
136
76
 
137
77
  - macOS or Linux
138
78
  - Node.js 20+
139
79
  - npm 10+
140
- - `codex` CLI installed and available in `PATH`
141
- - `git` installed and available in `PATH`
142
- - Tailscale on host machine + phone (recommended)
143
- - Expo Go on phone (for non-standalone flow)
144
-
145
- `clawdex init` / `setup:wizard` can install most missing machine prerequisites during onboarding (with prompts). `node` and `npm` must already be installed to run the package itself.
146
-
147
- Mobile runtime accepts `EXPO_PUBLIC_HOST_BRIDGE_URL` / `EXPO_PUBLIC_HOST_BRIDGE_TOKEN` (preferred). Legacy `EXPO_PUBLIC_MAC_BRIDGE_URL` / `EXPO_PUBLIC_MAC_BRIDGE_TOKEN` are still accepted for backward compatibility.
80
+ - `codex` CLI in `PATH`
81
+ - `git` in `PATH`
82
+ - iOS app installed (TestFlight/App Store/dev build)
83
+ - Tailscale on host + phone (recommended for remote/private networking)
148
84
 
149
- Optional for local simulator/emulator workflows:
85
+ Optional for simulators/emulators:
150
86
 
151
87
  - Xcode + iOS Simulator
152
88
  - Android Studio + Android Emulator
153
89
 
154
- ## Manual Secure Setup (No Wizard)
155
-
156
- ### 1) Install dependencies
157
-
158
- ```bash
159
- npm install
160
- ```
161
-
162
- ### 2) Generate secure runtime config
163
-
164
- ```bash
165
- npm run secure:setup
166
- ```
167
-
168
- This creates/updates:
169
-
170
- - `.env.secure` (bridge runtime config + token)
171
- - `apps/mobile/.env` (bridge URL/token for mobile app)
172
-
173
- ### 3) Start bridge
174
-
175
- ```bash
176
- npm run secure:bridge
177
- ```
178
-
179
- ### 4) Start Expo
180
-
181
- ```bash
182
- npm run mobile
183
- ```
184
-
185
- `npm run mobile` uses `scripts/start-expo.sh`, which sets `REACT_NATIVE_PACKAGER_HOSTNAME` to your configured secure host (from `.env.secure`), so QR resolves predictably.
186
-
187
90
  ## Day-to-Day Commands
188
91
 
189
92
  From repo root:
190
93
 
191
- - `npm run setup:wizard` — guided setup + auto bridge/expo launch by default
192
- - `npm run stop:services` — stop running Expo + bridge for this project
94
+ - `npm run setup:wizard` — guided secure setup + optional bridge start
95
+ - `npm run stop:services` — stop running bridge (and Expo if running)
193
96
  - `npm run secure:setup` — generate/update secure env
194
- - `npm run secure:bridge` — start rust bridge from `.env.secure`
195
- - `npm run mobile` — start Expo using configured host
196
- - `npm run ios` — start Expo for iOS target (same host strategy)
197
- - `npm run android` — start Expo for Android target (same host strategy)
198
- - `npm run teardown` — interactive teardown (stop processes + cleanup)
199
- - `npm run lint` — lint all workspaces
200
- - `npm run typecheck` typecheck all workspaces
201
- - `npm run build` — build all workspaces
202
-
203
- Published CLI equivalent:
97
+ - `npm run secure:bridge` — start rust bridge from `.env.secure` (release profile)
98
+ - `npm run secure:bridge:dev` — start rust bridge in dev profile
99
+ - `npm run mobile` — start Expo
100
+ - `npm run ios` — start Expo (iOS target)
101
+ - `npm run android` — start Expo (Android target)
102
+ - `npm run teardown` — interactive cleanup
103
+ - `npm run lint` / `npm run typecheck` / `npm run build`
204
104
 
205
- - `npm install -g clawdex-mobile@latest` — install/upgrade the published CLI
206
- - `clawdex init` — full interactive onboarding + auto-start
207
- - `clawdex stop` — stop running Expo + bridge for this project
208
- - `clawdex upgrade` / `clawdex update` — upgrade global CLI package to latest
209
- - `clawdex upgrade --version 1.1.2` — upgrade to a specific published version
210
- - `clawdex upgrade --restart` — stop services, upgrade, then restart via `clawdex init`
211
- - `clawdex version` — print installed CLI version
212
- - `clawdex init --no-start` — onboarding without launching bridge/expo
213
- - `clawdex init --platform ios` — auto-start with iOS target
105
+ Published CLI:
214
106
 
215
- ## NPM Release Automation
107
+ - `clawdex init`
108
+ - `clawdex stop`
109
+ - `clawdex upgrade` / `clawdex update`
110
+ - `clawdex version`
216
111
 
217
- GitHub Actions publishes `clawdex-mobile` to npm from `.github/workflows/npm-release.yml`.
112
+ ## Bridge Start Flow
218
113
 
219
- Required repo secret:
220
-
221
- - `NPM_TOKEN` (npm automation token with publish access to `clawdex-mobile`)
222
- add it in GitHub: `Settings -> Secrets and variables -> Actions -> New repository secret`
223
-
224
- Recommended release flow:
114
+ Recommended:
225
115
 
226
116
  ```bash
227
- # from main
228
- npm version patch
229
- git push origin main --follow-tags
117
+ npm install -g clawdex-mobile@latest
118
+ clawdex init
230
119
  ```
231
120
 
232
- What happens:
233
-
234
- - Workflow triggers on tag push (`v*`) or manual `workflow_dispatch`
235
- - It verifies `vX.Y.Z` tag matches `package.json` version
236
- - It runs `npm publish` to the npm registry
237
-
238
- ## Advanced Knobs
239
-
240
- Optional environment variables:
241
-
242
- - `CLAWDEX_SETUP_VERBOSE=true` — show full installer output during onboarding (instead of quiet mode)
243
- - `BRIDGE_HEALTH_WAIT_SECS=300` — max wait for bridge `/health` before reprompt
244
- - `EXPO_OUTPUT_WAIT_SECS=90` — spinner timeout before continuing to stream Expo logs
245
- - `EXPO_AUTO_REPAIR=true` — auto-repair React Native runtime when `npm run mobile` detects incomplete deps
246
- - `EXPO_CLEAR_CACHE=true` — force `expo start --clear` via `npm run mobile`
247
-
248
- ## Teardown / Cleanup
249
-
250
- Use:
121
+ Monorepo/manual flow:
251
122
 
252
123
  ```bash
253
- npm run teardown
124
+ # from repo root
125
+ npm install
126
+ npm run secure:setup
127
+ npm run secure:bridge
254
128
  ```
255
129
 
256
- Teardown can:
257
-
258
- - stop running Expo + bridge processes
259
- - remove generated artifacts (`.env.secure`, `.bridge.log`, `.expo.log`, pid files)
260
- - optionally reset `apps/mobile/.env` from `.env.example`
261
- - optionally run `tailscale down`
130
+ Keep `npm run secure:bridge` running in foreground. It prints pairing QR and bridge logs.
262
131
 
263
- Non-interactive mode:
132
+ In a second terminal, start the app runtime:
264
133
 
265
134
  ```bash
266
- npm run teardown -- --yes
135
+ npm run mobile
267
136
  ```
268
137
 
269
- ## Environment Reference
270
-
271
- ### Bridge runtime (`.env.secure`, generated)
272
-
273
- | Variable | Purpose |
274
- |---|---|
275
- | `BRIDGE_HOST` | bind host for rust bridge |
276
- | `BRIDGE_PORT` | bridge port (default `8787`) |
277
- | `BRIDGE_AUTH_TOKEN` | required auth token |
278
- | `BRIDGE_ALLOW_QUERY_TOKEN_AUTH` | query token auth fallback |
279
- | `CODEX_CLI_BIN` | codex executable |
280
- | `BRIDGE_WORKDIR` | absolute working directory for terminal/git |
281
- | `BRIDGE_ALLOW_OUTSIDE_ROOT_CWD` | allow terminal/git `cwd` outside `BRIDGE_WORKDIR` (default `true`) |
282
-
283
- ### Mobile runtime (`apps/mobile/.env`, generated/updated)
284
-
285
- | Variable | Purpose |
286
- |---|---|
287
- | `EXPO_PUBLIC_HOST_BRIDGE_URL` | bridge base URL |
288
- | `EXPO_PUBLIC_HOST_BRIDGE_TOKEN` | token sent by mobile client |
289
- | `EXPO_PUBLIC_ALLOW_QUERY_TOKEN_AUTH` | web query-token behavior |
290
- | `EXPO_PUBLIC_ALLOW_INSECURE_REMOTE_BRIDGE` | suppress insecure-HTTP warning |
291
- | `EXPO_PUBLIC_PRIVACY_POLICY_URL` | in-app Privacy link |
292
- | `EXPO_PUBLIC_TERMS_OF_SERVICE_URL` | in-app Terms link |
138
+ ## Onboarding In App
293
139
 
294
- ## Production Readiness Checklist
140
+ On first launch (or after reset):
295
141
 
296
- Use this checklist before broader internal rollout:
142
+ 1. choose mode (`Local` or `Tailscale`)
143
+ 2. scan bridge QR to autofill URL + token
144
+ 3. use `Test Connection` (health + authenticated RPC check)
145
+ 4. tap `Continue`
297
146
 
298
- - Keep bridge network-private only (Tailscale/private LAN/VPN + host firewall); never public internet.
299
- - Require `BRIDGE_AUTH_TOKEN` and keep `BRIDGE_ALLOW_QUERY_TOKEN_AUTH=false` unless you explicitly need query-token fallback.
300
- - Do not set `BRIDGE_ALLOW_INSECURE_NO_AUTH=true` outside local debugging.
301
- - Scope `BRIDGE_WORKDIR` to the smallest repository/root required; set `BRIDGE_ALLOW_OUTSIDE_ROOT_CWD=false` if you want to enforce root confinement.
302
- - Keep mobile approval defaults strict (current mobile behavior uses untrusted policy + workspace-write sandbox).
303
- - Treat `Session` and `Allow similar` approval decisions as privileged actions; use only on trusted repos.
304
- - Run bridge under a supervisor (for example `launchd`) with restart policy and centralized logs.
305
- - Rotate bridge tokens periodically and immediately on device loss.
306
- - Pin and regularly update `codex` CLI, Node dependencies, Expo SDK, and OS patches.
147
+ ## EAS Builds (Short)
307
148
 
308
- ## Verifying Setup
309
-
310
- ### Bridge health
149
+ Run EAS commands from `apps/mobile` (that is where `app.json` and `eas.json` live):
311
150
 
312
151
  ```bash
313
- curl "$(awk -F= '/^EXPO_PUBLIC_HOST_BRIDGE_URL=/{print $2}' apps/mobile/.env)/health"
152
+ cd apps/mobile
153
+ eas build --platform ios --profile preview
154
+ eas build --platform android --profile preview
314
155
  ```
315
156
 
316
- Expected: JSON containing `"status":"ok"`.
317
-
318
- ### In-app smoke test
319
-
320
- 1. Open app, check `Settings` shows bridge connected.
321
- 2. Open the sidebar and set `Start Directory` (optional).
322
- 3. Create a chat and send a prompt.
323
- 4. Open collaboration mode and set `Plan mode` (mode chip or `/plan on`).
324
- 5. Send: `Ask one clarifying question with exactly 3 options.`
325
- 6. Confirm `Clarification needed` modal appears and submits successfully.
326
- 7. Open Git from chat header:
327
- - changed files visible
328
- - commit works
329
- - push button appears when branch is ahead
330
- 8. Tap the composer `+` button and test:
331
- - attach via workspace path (autocomplete suggestions should appear)
332
- - attach a file from phone
333
- - attach an image from phone
334
- 9. Send a long-running prompt, tap the stop button in composer, and verify:
335
- - run transitions to stopped
336
- - transcript contains `Turn stopped by user.`
337
-
338
- ## Choosing Start Directory (Home/Sidebar)
339
-
340
- You can control where new chats start from directly in the mobile app:
341
-
342
- 1. Open the left sidebar.
343
- 2. Under `Start Directory`, tap the directory row.
344
- 3. Pick one of:
345
- - `Bridge default workspace`
346
- - any workspace path discovered from your existing chats
347
-
348
- Behavior:
349
-
350
- - This selection is used when creating a new chat.
351
- - Existing chats keep their own workspace unless you change them from chat Git/workspace controls.
352
- - If you choose `Bridge default workspace`, chat creation falls back to bridge-level `BRIDGE_WORKDIR`.
353
-
354
- ## Model Selection and Slash Commands
157
+ For complete build/submit guidance, see [`docs/eas-builds.md`](docs/eas-builds.md).
355
158
 
356
- - Open model picker from:
357
- - home compose screen (model row), or
358
- - active chat metadata row (model chip)
359
- - Selected model applies to new chats and subsequent turns started from mobile.
360
- - Collaboration mode can be changed from:
361
- - active chat metadata mode chip (`Default mode` / `Plan mode`)
362
- - home compose mode row
363
- - `/plan` slash command
159
+ ## Local Builds (No EAS Cloud)
364
160
 
365
- Supported mobile slash commands:
366
-
367
- - `/help`
368
- - `/new`
369
- - `/model [model-id]`
370
- - `/plan [on|off|prompt]`
371
- - `/status`
372
- - `/rename <new-name>`
373
- - `/compact`
374
- - `/review`
375
- - `/fork`
376
- - `/diff`
377
-
378
- `/plan` behaviors:
379
-
380
- - `/plan on` enables plan mode for following turns.
381
- - `/plan off` returns to default mode.
382
- - `/plan <prompt>` sends that prompt in plan mode immediately.
383
- - If no chat is open, `/plan <prompt>` creates a new chat and runs it.
384
-
385
- ## Plan Mode, Clarifications, and Approvals
386
-
387
- ### Plan mode
388
-
389
- - Plan mode is sent through `turn/start` using structured `collaborationMode` payloads.
390
- - The app auto-switches to plan mode when plan events are received or when Codex reports `request_user_input` is unavailable in default mode.
391
- - Plan cards stream in chat via `item/plan/delta` and `turn/plan/updated`.
392
-
393
- ### Clarifying questions
394
-
395
- - Structured clarifications (`request_user_input`) open a `Clarification needed` modal.
396
- - Option buttons are selectable; freeform answer boxes appear only when needed (`isOther` or no preset options).
397
- - Multi-question requests require all answers before submit.
398
- - If Codex emits numbered options as plain text instead of structured questions, mobile renders tappable fallback options beneath the assistant message.
399
-
400
- ### Approval UX
401
-
402
- - Command/file approvals are surfaced as a banner with:
403
- - `Deny`
404
- - `Allow once`
405
- - `Session`
406
- - `Allow similar` (when the bridge receives exec-policy amendment suggestions)
407
- - Approval events are bridged through `bridge/approval.requested` and `bridge/approval.resolved`.
408
-
409
- ## Standalone App Install (Without Expo Go)
410
-
411
- Yes, this is supported.
412
-
413
- ### Option A: EAS Cloud Builds (Recommended)
414
-
415
- This is the most reliable path for standalone installs.
416
-
417
- #### Step 1: Install and login EAS CLI
418
-
419
- ```bash
420
- npm install -g eas-cli
421
- npx eas login
422
- ```
423
-
424
- #### Step 2: Configure Expo/EAS in app workspace
161
+ Run from `apps/mobile`:
425
162
 
426
163
  ```bash
427
164
  cd apps/mobile
428
- npx eas build:configure
429
- ```
430
-
431
- This will create `eas.json` if missing.
432
-
433
- #### Step 3: Set app identifiers in `apps/mobile/app.json`
434
-
435
- Add unique IDs:
436
-
437
- ```json
438
- {
439
- "expo": {
440
- "ios": {
441
- "bundleIdentifier": "com.yourorg.clawdexmobile"
442
- },
443
- "android": {
444
- "package": "com.yourorg.clawdexmobile"
445
- }
446
- }
447
- }
448
165
  ```
449
166
 
450
- #### Step 4: Build standalone binaries
451
-
452
- From `apps/mobile`:
167
+ iOS:
453
168
 
454
169
  ```bash
455
- # Android internal distribution
456
- npx eas build -p android --profile preview
457
-
458
- # iOS internal distribution (device allowlist required)
459
- npx eas build -p ios --profile preview
460
- ```
461
-
462
- Notes:
170
+ # iOS Simulator
171
+ npx expo run:ios
463
172
 
464
- - iOS internal builds require Apple Developer account + device provisioning.
465
- - For iOS device registration flows, use `npx eas device:create`.
466
- - No App Store submission is required for internal distribution.
467
-
468
- ### Option B: Local Native Builds (No EAS Cloud)
469
-
470
- From `apps/mobile`:
471
-
472
- ```bash
173
+ # Connected iPhone
473
174
  npx expo run:ios --device
474
- npx expo run:android --device
475
175
  ```
476
176
 
477
- Use this only if your local native toolchains/signing are already configured.
478
-
479
- ## iOS Distribution Reality (Important)
480
-
481
- iOS does not allow arbitrary sideloading like Android. Without public App Store release, your practical paths are:
482
-
483
- 1. Development/Internal (device allowlist via provisioning)
484
- 2. TestFlight private testing
485
-
486
- So yes, cloud builds without App Store listing are possible, but still require Apple signing/provisioning.
487
-
488
- ## API Summary (Rust Bridge)
489
-
490
- ### Endpoints
491
-
492
- - `GET /health`
493
- - `GET /rpc` (WebSocket JSON-RPC)
494
-
495
- ### Forwarded methods
496
-
497
- - `thread/*`
498
- - `turn/*` (includes `turn/interrupt` used by mobile stop control)
499
- - `review/start`
500
- - `model/list`
501
- - `skills/list`
502
- - `app/list`
503
-
504
- ### Bridge RPC methods
505
-
506
- - `bridge/health/read`
507
- - `bridge/terminal/exec`
508
- - `bridge/attachments/upload`
509
- - `bridge/git/status`
510
- - `bridge/git/diff`
511
- - `bridge/git/commit`
512
- - `bridge/git/push`
513
- - `bridge/approvals/list`
514
- - `bridge/approvals/resolve`
515
- - `bridge/userInput/resolve`
516
-
517
- ### Notifications (examples)
177
+ Android:
518
178
 
519
- - `turn/*`, `item/*`
520
- - `bridge/approval.*`
521
- - `bridge/userInput.*`
522
- - `bridge/terminal/completed`
523
- - `bridge/git/updated`
524
- - `bridge/connection/state`
525
-
526
- ## Troubleshooting
527
-
528
- ### Onboarding looks stuck before Expo logs appear
529
-
530
- - This is usually Expo startup latency (first launch can take time while Metro initializes).
531
- - You should see a spinner line like `Waiting for Expo output ...` before logs begin.
532
- - Tune spinner timeout if needed:
533
- ```bash
534
- EXPO_OUTPUT_WAIT_SECS=180 clawdex init
535
- ```
536
- - If Expo never emits logs, inspect:
537
- ```bash
538
- tail -n 120 .expo.log
539
- ```
540
-
541
- ### Expo starts but QR/network is wrong
542
-
543
- - Re-run `npm run secure:setup`
544
- - Confirm `.env.secure` has the correct `BRIDGE_HOST`
545
- - Restart `npm run mobile`
546
-
547
- ### Stop all running services quickly
548
-
549
- - Preferred:
550
179
  ```bash
551
- clawdex stop
552
- ```
553
- - From repo checkout:
554
- ```bash
555
- npm run stop:services
180
+ # Android emulator or connected Android device
181
+ npx expo run:android
556
182
  ```
557
183
 
558
- ### Bridge auth errors (`401`, invalid token)
559
-
560
- - Ensure `BRIDGE_AUTH_TOKEN` in `.env.secure` matches `EXPO_PUBLIC_HOST_BRIDGE_TOKEN` in `apps/mobile/.env`
561
- - Restart bridge and Expo after token changes
562
-
563
- ### Tailscale issues
564
-
565
- - Verify both host machine and phone are on the same Tailscale network
566
- - Run `tailscale ip -4` and verify host in `apps/mobile/.env`
184
+ Optional local EAS build:
567
185
 
568
- ### `codex` not found
569
-
570
- - Ensure `codex` is in `PATH`, or set `CODEX_CLI_BIN` accordingly
571
-
572
- ### Bridge build fails with `linker 'cc' not found`
573
-
574
- - Install system C build tools:
575
186
  ```bash
576
- sudo apt-get update && sudo apt-get install -y build-essential
187
+ # Requires local Android SDK / Xcode setup
188
+ eas build --platform android --profile preview --local
577
189
  ```
578
- - Then retry `npm run secure:bridge`.
579
- - `setup:wizard` now checks and installs this prerequisite automatically.
580
190
 
581
- ### iOS bundling error: `Unable to resolve "./BoundingDimensions"`
191
+ ## Documentation Map
582
192
 
583
- - `npm run mobile` now performs an automatic runtime integrity check and repair.
584
- - If the error persists, run manual recovery:
585
- ```bash
586
- npm install --include=dev --force
587
- npm install --include=dev --force -w apps/mobile
588
- npm run -w apps/mobile start -- --clear
589
- ```
193
+ - Setup + operations: [`docs/setup-and-operations.md`](docs/setup-and-operations.md)
194
+ - Troubleshooting: [`docs/troubleshooting.md`](docs/troubleshooting.md)
195
+ - Realtime sync limits/mitigations: [`docs/realtime-streaming-limitations.md`](docs/realtime-streaming-limitations.md)
196
+ - Voice transcription internals: [`docs/voice-transcription.md`](docs/voice-transcription.md)
197
+ - Open-source license obligations: [`docs/open-source-license-requirements.md`](docs/open-source-license-requirements.md)
198
+ - App review template: [`docs/app-review-notes.md`](docs/app-review-notes.md)
199
+ - App-server/CLI gap tracking: [`docs/codex-app-server-cli-gap-tracker.md`](docs/codex-app-server-cli-gap-tracker.md)
590
200
 
591
- ### Runtime errors: `[runtime not ready]` / `property is not writable`
592
-
593
- - This usually indicates a corrupted React Native install or stale Metro cache.
594
- - `npm run mobile` now auto-repairs this in most cases.
595
- - If needed, run manual recovery:
596
- ```bash
597
- rm -rf node_modules apps/mobile/node_modules
598
- npm install --include=dev --force
599
- npm install --include=dev --force -w apps/mobile
600
- npm run -w apps/mobile start -- --clear
601
- ```
602
- - Also update Expo Go to the latest version on your phone.
603
-
604
- ### Git operations fail
605
-
606
- - Verify chat workspace path points to a valid git repo
607
- - Verify git auth/remote access for push
608
-
609
- ### Attachment upload issues
610
-
611
- - Ensure file/photo permissions are granted to the mobile app (or Expo Go).
612
- - Attachment uploads are capped at `20 MB` per file by the bridge.
613
- - Uploaded payloads are persisted under `BRIDGE_WORKDIR/.clawdex-mobile-attachments` (thread subfolders when thread id is known).
614
- - Ensure the configured `BRIDGE_WORKDIR` is writable.
615
-
616
- ### Worklets/Reanimated mismatch
617
-
618
- - Keep pinned versions aligned (`react-native-reanimated@4.1.1`, `react-native-worklets@0.5.1`)
619
- - Clear Expo cache:
620
-
621
- ```bash
622
- npm run -w apps/mobile start -- --clear
623
- ```
624
-
625
- ### Plan mode errors (`RPC-32600` invalid `collaborationMode`)
626
-
627
- - Ensure mobile app is running the latest JS bundle (restart Expo and reload app).
628
- - Ensure bridge and mobile are on matching repo revisions.
629
- - If you still see this after pull/restart, run the API test suite:
630
-
631
- ```bash
632
- npm run -w apps/mobile test -- --runInBand src/api/__tests__/client.test.ts
633
- ```
634
-
635
- ### Stop button does not interrupt a run
636
-
637
- - Ensure bridge/mobile are on a revision that supports `turn/interrupt`.
638
- - If the run already completed, the stop button will disappear and no stop entry will be added.
639
- - If needed, pull latest, restart bridge, and reload Expo bundle.
201
+ ## Open Source License Requirements
640
202
 
641
- ## Legacy TypeScript Bridge
203
+ Follow project requirements in:
642
204
 
643
- `services/mac-bridge` remains available for reference only.
644
- Primary path is `services/rust-bridge`.
205
+ - `LICENSE`
206
+ - `docs/open-source-license-requirements.md`
645
207
 
646
208
  ## Development Checks
647
209