# saya-ch/dsh-mobile architecture

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

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

## Overview

DSH Mobile is a DeepSeek Harness plugin plus an Android client for securely continuing desktop sessions on a phone. The principal flow is desktop setup and pairing, LAN or remote connection, gateway authentication, then access to the existing DSH web experience; Android stores paired devices and reconnects to gateways. Separate product branches provide remote-channel management, mobile UI customization, diagnostics, extensions, and task notifications. README capabilities inform several branches whose implementation was not sampled; those links are shown only where the documented responsibility is clear.

Main entry points: [`src/gateway.ts`](https://github.com/saya-ch/dsh-mobile/blob/main/src/gateway.ts) (HTTPS gateway), [`src/client.ts`](https://github.com/saya-ch/dsh-mobile/blob/main/src/client.ts) (Mobile panel), [`src/remote.ts`](https://github.com/saya-ch/dsh-mobile/blob/main/src/remote.ts) (Remote channel manager), [`apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/MainActivity.kt`](https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/MainActivity.kt) (Android app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["DSH integration"]
  node_plugin["Plugin entry<br/>[plugin.ts]"]
  node_control["Access control<br/>[control.ts]"]
  node_panel["Mobile panel<br/>[client.ts]"]
end

subgraph group_gateway["Access gateway"]
  node_gateway["HTTPS gateway<br/>[gateway.ts]"]
  node_auth["Pairing and sessions<br/>[access.ts]"]
  node_authpages["Browser pairing<br/>[auth-pages.ts]"]
  node_device_store[("Device records<br/>[storage.ts]")]
  node_network_policy["Request security<br/>[network.ts]"]
end

subgraph group_connectivity["Connectivity"]
  node_lan_setup["LAN setup<br/>[lan-setup.ts]"]
  node_remote["Remote channel manager<br/>[remote.ts]"]
  node_frp["FRP support<br/>[frp.ts]"]
  node_cloudflared["Cloudflared support<br/>[cloudflared.ts]"]
  node_cpolar["Cpolar support<br/>[cpolar.ts]"]
  node_funnel["Tailscale Funnel<br/>[funnel.ts]"]
  node_funnel_host["Funnel host<br/>[main.go]"]
end

subgraph group_mobile["Mobile clients"]
  node_android["Android app<br/>[MainActivity.kt]"]
  node_native_auth["Native authentication"]
  node_scanner["QR scanner<br/>[ScanActivity.kt]"]
end

subgraph group_features["Product features"]
  node_mobile_layout["Touch layout<br/>[mobile-layout.ts]"]
  node_customize["Mobile customization<br/>[mobile-compat.ts]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.ts]"]
  node_extensions["Mobile extensions<br/>[extensions.ts]"]
  node_task_events["Task events<br/>[task-events.ts]"]
  node_notify["Task notifications<br/>[task-notify.ts]"]
end

node_operator(("Computer user"))
node_phoneuser(("Phone user"))
node_dsh["DSH runtime"]

node_operator -->|"configures access"| node_panel
node_dsh -->|"loads plugin"| node_plugin
node_plugin -->|"registers controls"| node_control
node_control -->|"manages gateway"| node_gateway
node_panel -->|"manages settings"| node_control
node_panel -->|"sets up LAN"| node_lan_setup
node_panel -->|"selects channel"| node_remote
node_remote -->|"manages FRP"| node_frp
node_remote -->|"manages tunnel"| node_cloudflared
node_remote -->|"manages tunnel"| node_cpolar
node_remote -->|"manages Funnel"| node_funnel
node_funnel -->|"controls process"| node_funnel_host
node_phoneuser -->|"scans pairing QR"| node_scanner
node_scanner -->|"returns scan"| node_android
node_android -->|"pairs and renews"| node_native_auth
node_native_auth -->|"authenticates device"| node_gateway
node_android -->|"stores pairing"| node_device_store
node_gateway -->|"checks sessions"| node_auth
node_auth -->|"reads and writes"| node_device_store
node_gateway -->|"serves pairing"| node_authpages
node_gateway -->|"checks requests"| node_network_policy
node_phoneuser -->|"opens mobile access"| node_gateway
node_gateway -->|"proxies web access"| node_dsh
node_gateway -->|"serves mobile view"| node_mobile_layout
node_operator -->|"requests layout"| node_customize
node_panel -->|"runs checks"| node_diagnostics
node_panel -->|"manages extensions"| node_extensions
node_task_events -->|"emits task events"| node_notify
node_notify -->|"signals app"| node_android

click node_plugin "https://github.com/saya-ch/dsh-mobile/blob/main/src/plugin.ts"
click node_control "https://github.com/saya-ch/dsh-mobile/blob/main/src/control.ts"
click node_panel "https://github.com/saya-ch/dsh-mobile/blob/main/src/client.ts"
click node_gateway "https://github.com/saya-ch/dsh-mobile/blob/main/src/gateway.ts"
click node_auth "https://github.com/saya-ch/dsh-mobile/blob/main/src/access.ts"
click node_authpages "https://github.com/saya-ch/dsh-mobile/blob/main/src/auth-pages.ts"
click node_device_store "https://github.com/saya-ch/dsh-mobile/blob/main/src/storage.ts"
click node_network_policy "https://github.com/saya-ch/dsh-mobile/blob/main/src/network.ts"
click node_lan_setup "https://github.com/saya-ch/dsh-mobile/blob/main/src/lan-setup.ts"
click node_remote "https://github.com/saya-ch/dsh-mobile/blob/main/src/remote.ts"
click node_frp "https://github.com/saya-ch/dsh-mobile/blob/main/src/frp.ts"
click node_cloudflared "https://github.com/saya-ch/dsh-mobile/blob/main/src/cloudflared.ts"
click node_cpolar "https://github.com/saya-ch/dsh-mobile/blob/main/src/cpolar.ts"
click node_funnel "https://github.com/saya-ch/dsh-mobile/blob/main/src/funnel.ts"
click node_android "https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/MainActivity.kt"
click node_native_auth "https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/NativeAuthClient.kt"
click node_scanner "https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/ScanActivity.kt"
click node_mobile_layout "https://github.com/saya-ch/dsh-mobile/blob/main/src/mobile-layout.ts"
click node_customize "https://github.com/saya-ch/dsh-mobile/blob/main/src/mobile-compat.ts"
click node_diagnostics "https://github.com/saya-ch/dsh-mobile/blob/main/src/diagnostics.ts"
click node_extensions "https://github.com/saya-ch/dsh-mobile/blob/main/src/extensions.ts"
click node_task_events "https://github.com/saya-ch/dsh-mobile/blob/main/src/task-events.ts"
click node_notify "https://github.com/saya-ch/dsh-mobile/blob/main/src/task-notify.ts"
click node_funnel_host "https://github.com/saya-ch/dsh-mobile/blob/main/native/funnel-host/main.go"

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_plugin,node_control,node_panel,node_operator,node_phoneuser toneBlue
class node_gateway,node_auth,node_authpages,node_device_store,node_network_policy toneAmber
class node_lan_setup,node_remote,node_frp,node_cloudflared,node_cpolar,node_funnel,node_funnel_host toneMint
class node_android,node_native_auth,node_scanner toneRose
class node_mobile_layout,node_customize,node_diagnostics,node_extensions,node_task_events,node_notify,node_dsh toneIndigo
```

## Components

### DSH integration

- [Plugin entry](https://github.com/saya-ch/dsh-mobile/blob/main/src/plugin.ts): `src/plugin.ts`
- [Access control](https://github.com/saya-ch/dsh-mobile/blob/main/src/control.ts): `src/control.ts`
- [Mobile panel](https://github.com/saya-ch/dsh-mobile/blob/main/src/client.ts): `src/client.ts`

### Access gateway

- [HTTPS gateway](https://github.com/saya-ch/dsh-mobile/blob/main/src/gateway.ts): `src/gateway.ts`
- [Pairing and sessions](https://github.com/saya-ch/dsh-mobile/blob/main/src/access.ts): `src/access.ts`
- [Browser pairing](https://github.com/saya-ch/dsh-mobile/blob/main/src/auth-pages.ts): `src/auth-pages.ts`
- [Device records](https://github.com/saya-ch/dsh-mobile/blob/main/src/storage.ts): `src/storage.ts`
- [Request security](https://github.com/saya-ch/dsh-mobile/blob/main/src/network.ts): `src/network.ts`

### Connectivity

- [LAN setup](https://github.com/saya-ch/dsh-mobile/blob/main/src/lan-setup.ts): `src/lan-setup.ts`
- [Remote channel manager](https://github.com/saya-ch/dsh-mobile/blob/main/src/remote.ts): `src/remote.ts`
- [FRP support](https://github.com/saya-ch/dsh-mobile/blob/main/src/frp.ts): `src/frp.ts`
- [Cloudflared support](https://github.com/saya-ch/dsh-mobile/blob/main/src/cloudflared.ts): `src/cloudflared.ts`
- [Cpolar support](https://github.com/saya-ch/dsh-mobile/blob/main/src/cpolar.ts): `src/cpolar.ts`
- [Tailscale Funnel](https://github.com/saya-ch/dsh-mobile/blob/main/src/funnel.ts): `src/funnel.ts`
- [Funnel host](https://github.com/saya-ch/dsh-mobile/blob/main/native/funnel-host/main.go): `native/funnel-host/main.go`

### Mobile clients

- [Android app](https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/MainActivity.kt): `apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/MainActivity.kt`
- [Native authentication](https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/NativeAuthClient.kt): `apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/NativeAuthClient.kt`
- [QR scanner](https://github.com/saya-ch/dsh-mobile/blob/main/apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/ScanActivity.kt): `apps/mobile/android/app/src/main/java/io/github/sayach/dshmobile/ScanActivity.kt`

### Product features

- [Touch layout](https://github.com/saya-ch/dsh-mobile/blob/main/src/mobile-layout.ts): `src/mobile-layout.ts`
- [Mobile customization](https://github.com/saya-ch/dsh-mobile/blob/main/src/mobile-compat.ts): `src/mobile-compat.ts`
- [Diagnostics](https://github.com/saya-ch/dsh-mobile/blob/main/src/diagnostics.ts): `src/diagnostics.ts`
- [Mobile extensions](https://github.com/saya-ch/dsh-mobile/blob/main/src/extensions.ts): `src/extensions.ts`
- [Task events](https://github.com/saya-ch/dsh-mobile/blob/main/src/task-events.ts): `src/task-events.ts`
- [Task notifications](https://github.com/saya-ch/dsh-mobile/blob/main/src/task-notify.ts): `src/task-notify.ts`

### Other components

- **Computer user**
- **Phone user**
- **DSH runtime**

## Connections

- Computer user → Mobile panel: configures access
- DSH runtime → Plugin entry: loads plugin
- Plugin entry → Access control: registers controls
- Access control → HTTPS gateway: manages gateway
- Mobile panel → Access control: manages settings
- Mobile panel → LAN setup: sets up LAN
- Mobile panel → Remote channel manager: selects channel
- Remote channel manager → FRP support: manages FRP
- Remote channel manager → Cloudflared support: manages tunnel
- Remote channel manager → Cpolar support: manages tunnel
- Remote channel manager → Tailscale Funnel: manages Funnel
- Tailscale Funnel → Funnel host: controls process
- Phone user → QR scanner: scans pairing QR
- QR scanner → Android app: returns scan
- Android app → Native authentication: pairs and renews
- Native authentication → HTTPS gateway: authenticates device
- Android app → Device records: stores pairing
- HTTPS gateway → Pairing and sessions: checks sessions
- Pairing and sessions → Device records: reads and writes
- HTTPS gateway → Browser pairing: serves pairing
- HTTPS gateway → Request security: checks requests
- Phone user → HTTPS gateway: opens mobile access
- HTTPS gateway → DSH runtime: proxies web access
- HTTPS gateway → Touch layout: serves mobile view
- Computer user → Mobile customization: requests layout
- Mobile panel → Diagnostics: runs checks
- Mobile panel → Mobile extensions: manages extensions
- Task events → Task notifications: emits task events
- Task notifications → Android app: signals app
