# thness/dsh-mobile architecture

> Architecture diagram of the GitHub repository thness/dsh-mobile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thness/dsh-mobile
- Repository: https://github.com/thness/dsh-mobile

## Overview

DeepSeek Harness Mobile is an Android shell for running the DeepSeek Harness locally: the app starts an embedded Node.js engine, displays its web UI in a WebView, and bridges selected Android capabilities. The main path is launch → extract/start runtime → serve the local UI. The README also documents background keep-alive, external workspace support, optional Shizuku integration, and OTA updates. Some supporting paths are based on README claims because their implementation was not sampled.

Main entry points: [`app/src/main/java/com/dshmobile/shell/MainActivity.kt`](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/MainActivity.kt) (App UI), [`app/src/main/java/com/dshmobile/shell/EngineManager.kt`](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineManager.kt) (Engine lifecycle), [`app/src/main/java/com/dshmobile/shell/UpdateManager.kt`](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/UpdateManager.kt) (OTA updater), [`app/src/main/java/com/dshmobile/shell/AndroidBridge.kt`](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/AndroidBridge.kt) (JavaScript bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android shell"]
  node_activity["App UI<br/>[MainActivity.kt]"]
  node_webview["Harness Web UI"]
  node_bridge["JavaScript bridge<br/>[AndroidBridge.kt]"]
end

subgraph group_engine["Local engine"]
  node_engine["Harness engine"]
  node_manager["Engine lifecycle<br/>[EngineManager.kt]"]
  node_probe["Engine probe<br/>[EngineProbe.kt]"]
  node_extractor["Snapshot extraction"]
end

subgraph group_storage["Workspace and files"]
  node_workspace[("External workspace")]
  node_documents[("Shared app data")]
  node_downloads[("Android Downloads")]
  node_picker["System directory picker"]
end

subgraph group_ops["Runtime operations"]
  node_service["Foreground service<br/>[EngineService.kt]"]
  node_update["OTA updater<br/>[UpdateManager.kt]"]
  node_manifest["Update server"]
  node_shizuku["Shizuku<br/>[ShizukuSupport.kt]"]
end

node_user(("User"))

node_user -->|"launches"| node_activity
node_activity -->|"starts engine flow"| node_manager
node_manager -->|"extracts snapshot"| node_extractor
node_manager -->|"starts process"| node_engine
node_engine -->|"serves local UI"| node_webview
node_activity -->|"loads local page"| node_webview
node_activity -->|"starts service"| node_service
node_service -->|"starts engine"| node_manager
node_service -->|"checks availability"| node_probe
node_manager -->|"migrates user data"| node_documents
node_engine -->|"accesses workspace"| node_workspace
node_engine -->|"reads and writes"| node_documents
node_webview -->|"calls bridge"| node_bridge
node_bridge -->|"checks engine"| node_probe
node_bridge -->|"requests Android actions"| node_activity
node_activity -->|"opens picker"| node_picker
node_picker -->|"returns selection"| node_activity
node_activity -->|"exports files"| node_workspace
node_activity -->|"saves export"| node_downloads
node_activity -->|"runs update"| node_update
node_update -->|"fetches update"| node_manifest
node_update -->|"extracts download"| node_extractor
node_update -->|"restarts via service watchdog"| node_engine
node_activity -.->|"checks optional status"| node_shizuku

click node_activity "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/MainActivity.kt"
click node_bridge "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/AndroidBridge.kt"
click node_manager "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineManager.kt"
click node_probe "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineProbe.kt"
click node_extractor "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/SnapshotExtractor.kt"
click node_service "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineService.kt"
click node_update "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/UpdateManager.kt"
click node_shizuku "https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/ShizukuSupport.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_activity,node_webview,node_bridge,node_user toneBlue
class node_engine,node_manager,node_probe,node_extractor toneAmber
class node_workspace,node_documents,node_downloads,node_picker toneMint
class node_service,node_update,node_manifest,node_shizuku toneRose
```

## Components

### Android shell

- [App UI](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/MainActivity.kt): `app/src/main/java/com/dshmobile/shell/MainActivity.kt`
- **Harness Web UI**
- [JavaScript bridge](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/AndroidBridge.kt): `app/src/main/java/com/dshmobile/shell/AndroidBridge.kt`

### Local engine

- **Harness engine**
- [Engine lifecycle](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineManager.kt): `app/src/main/java/com/dshmobile/shell/EngineManager.kt`
- [Engine probe](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineProbe.kt): `app/src/main/java/com/dshmobile/shell/EngineProbe.kt`
- [Snapshot extraction](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/SnapshotExtractor.kt): `app/src/main/java/com/dshmobile/shell/SnapshotExtractor.kt`

### Workspace and files

- **External workspace**
- **Shared app data**
- **Android Downloads**
- **System directory picker**

### Runtime operations

- [Foreground service](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/EngineService.kt): `app/src/main/java/com/dshmobile/shell/EngineService.kt`
- [OTA updater](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/UpdateManager.kt): `app/src/main/java/com/dshmobile/shell/UpdateManager.kt`
- **Update server**
- [Shizuku](https://github.com/thness/dsh-mobile/blob/main/app/src/main/java/com/dshmobile/shell/ShizukuSupport.kt): `app/src/main/java/com/dshmobile/shell/ShizukuSupport.kt`

### Other components

- **User**

## Connections

- User → App UI: launches
- App UI → Engine lifecycle: starts engine flow
- Engine lifecycle → Snapshot extraction: extracts snapshot
- Engine lifecycle → Harness engine: starts process
- Harness engine → Harness Web UI: serves local UI
- App UI → Harness Web UI: loads local page
- App UI → Foreground service: starts service
- Foreground service → Engine lifecycle: starts engine
- Foreground service → Engine probe: checks availability
- Engine lifecycle → Shared app data: migrates user data
- Harness engine → External workspace: accesses workspace
- Harness engine → Shared app data: reads and writes
- Harness Web UI → JavaScript bridge: calls bridge
- JavaScript bridge → Engine probe: checks engine
- JavaScript bridge → App UI: requests Android actions
- App UI → System directory picker: opens picker
- System directory picker → App UI: returns selection
- App UI → External workspace: exports files
- App UI → Android Downloads: saves export
- App UI → OTA updater: runs update
- OTA updater → Update server: fetches update
- OTA updater → Snapshot extraction: extracts download
- OTA updater → Harness engine: restarts via service watchdog
- App UI → Shizuku: checks optional status
