47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# Mobile App Structure
|
|
|
|
The mobile app is a Vite React app wrapped by Capacitor for Android. It remains runnable as a browser dev app while producing an installable APK through the generated Android project.
|
|
|
|
## Screens
|
|
|
|
- **Chat** sends prompts to `POST /api/chat` and displays Hermes replies.
|
|
- **Files** browses the companion workspace, opens UTF-8 files, edits content, and saves through HTTP.
|
|
- **Terminal** runs allowlisted workspace commands through the companion server.
|
|
- **Status** checks companion health, Hermes CLI availability, workspace root, and uptime.
|
|
- **Settings** stores the companion URL and access key in `localStorage` and validates pairing.
|
|
|
|
## Companion Settings
|
|
|
|
The default companion URL is `http://10.0.2.2:8787`, which is the standard Android emulator loopback address for a server running on the host computer.
|
|
|
|
For a physical Android device, set the URL to the host machine LAN address, for example `http://192.168.1.50:8787`, and make sure the firewall allows port `8787`.
|
|
|
|
## Development
|
|
|
|
```bash
|
|
npm run mobile:dev
|
|
```
|
|
|
|
## Android APK Build
|
|
|
|
After installing dependencies:
|
|
|
|
```bash
|
|
npm run cap:add:android --workspace @hermes-mobile/mobile
|
|
npm run android:build:debug --workspace @hermes-mobile/mobile
|
|
```
|
|
|
|
The debug APK is generated by Gradle at:
|
|
|
|
```text
|
|
apps/mobile/android/app/build/outputs/apk/debug/app-debug.apk
|
|
```
|
|
|
|
If `android/` already exists, use:
|
|
|
|
```bash
|
|
npm run cap:sync --workspace @hermes-mobile/mobile
|
|
cd apps/mobile/android
|
|
./gradlew assembleDebug
|
|
```
|