# glenngit/dsh-top architecture

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

- Interactive diagram: https://gitdiagram.com/glenngit/dsh-top
- Repository: https://github.com/glenngit/dsh-top

## Overview

dsh-top is a DeepSeek Harness web-GUI plugin for live host monitoring. Its workflow is: the browser panel polls a host API, the handler gathers CPU, memory, disk, network, and process data, and the panel renders the response. The host code also computes rates and uses Linux cgroups for container-aware CPU and memory reporting. The README documents the bundle patch as the client-loader integration. Host collection details are in one source file; the sampled excerpts do not show every collector call.

Main entry points: [`lib/index.js`](https://github.com/glenngit/dsh-top/blob/main/lib/index.js) (Stats handler), [`lib/client.js`](https://github.com/glenngit/dsh-top/blob/main/lib/client.js) (Stats poller), [`cordis.patch.yml`](https://github.com/glenngit/dsh-top/blob/main/cordis.patch.yml) (Bundle patch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host monitoring"]
  node_cpumem["CPU and memory<br/>[index.js]"]
  node_cgroups["Cgroup limits<br/>[index.js]"]
  node_disk["Disk collector<br/>[index.js]"]
  node_network["Network collector<br/>[index.js]"]
  node_processes["Process collector<br/>[index.js]"]
end

subgraph group_api["Stats API"]
  node_hosthandler["Stats handler<br/>[index.js]"]
  node_rates["Rate calculation<br/>[index.js]"]
end

subgraph group_gui["Browser panel"]
  node_pluginpatch["Bundle patch<br/>[cordis.patch.yml]"]
  node_poller["Stats poller<br/>[client.js]"]
  node_overlay["Overlay registration<br/>[client.js]"]
  node_panel["Monitor panel<br/>[client.js]"]
end

node_user(("DSH user"))
node_hostos{{"Host OS"}}
node_tools{{"System tools"}}

node_hosthandler -->|"samples"| node_cpumem
node_hosthandler -->|"collects"| node_disk
node_hosthandler -->|"collects"| node_network
node_hosthandler -->|"collects"| node_processes
node_cpumem -->|"checks limits"| node_cgroups
node_cpumem -->|"reads os stats"| node_hostos
node_cgroups -->|"reads cgroup files"| node_hostos
node_disk -->|"reads platform data"| node_hostos
node_disk -->|"runs platform commands"| node_tools
node_network -->|"reads platform data"| node_hostos
node_network -->|"runs platform commands"| node_tools
node_processes -->|"runs platform commands"| node_tools
node_hosthandler -->|"computes deltas"| node_rates
node_poller -->|"polls stats"| node_hosthandler
node_hosthandler -->|"returns JSON"| node_poller
node_pluginpatch -->|"loads client"| node_poller
node_overlay -->|"registers panel"| node_panel
node_user -->|"uses panel"| node_panel

click node_pluginpatch "https://github.com/glenngit/dsh-top/blob/main/cordis.patch.yml"
click node_hosthandler "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_cpumem "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_cgroups "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_disk "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_network "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_processes "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_rates "https://github.com/glenngit/dsh-top/blob/main/lib/index.js"
click node_poller "https://github.com/glenngit/dsh-top/blob/main/lib/client.js"
click node_overlay "https://github.com/glenngit/dsh-top/blob/main/lib/client.js"
click node_panel "https://github.com/glenngit/dsh-top/blob/main/lib/client.js"

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_cpumem,node_cgroups,node_disk,node_network,node_processes,node_user toneBlue
class node_hosthandler,node_rates toneAmber
class node_pluginpatch,node_poller,node_overlay,node_panel toneMint
class node_hostos,node_tools toneIndigo
```

## Components

### Host monitoring

- [CPU and memory](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`
- [Cgroup limits](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`
- [Disk collector](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`
- [Network collector](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`
- [Process collector](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`

### Stats API

- [Stats handler](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`
- [Rate calculation](https://github.com/glenngit/dsh-top/blob/main/lib/index.js): `lib/index.js`

### Browser panel

- [Bundle patch](https://github.com/glenngit/dsh-top/blob/main/cordis.patch.yml): `cordis.patch.yml`
- [Stats poller](https://github.com/glenngit/dsh-top/blob/main/lib/client.js): `lib/client.js`
- [Overlay registration](https://github.com/glenngit/dsh-top/blob/main/lib/client.js): `lib/client.js`
- [Monitor panel](https://github.com/glenngit/dsh-top/blob/main/lib/client.js): `lib/client.js`

### Other components

- **DSH user**
- **Host OS**
- **System tools**

## Connections

- Stats handler → CPU and memory: samples
- Stats handler → Disk collector: collects
- Stats handler → Network collector: collects
- Stats handler → Process collector: collects
- CPU and memory → Cgroup limits: checks limits
- CPU and memory → Host OS: reads os stats
- Cgroup limits → Host OS: reads cgroup files
- Disk collector → Host OS: reads platform data
- Disk collector → System tools: runs platform commands
- Network collector → Host OS: reads platform data
- Network collector → System tools: runs platform commands
- Process collector → System tools: runs platform commands
- Stats handler → Rate calculation: computes deltas
- Stats poller → Stats handler: polls stats
- Stats handler → Stats poller: returns JSON
- Bundle patch → Stats poller: loads client
- Overlay registration → Monitor panel: registers panel
- DSH user → Monitor panel: uses panel
