clawdex-mobile 1.3.2 → 2.0.1

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