# dwservice/agent architecture

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

- Interactive diagram: https://gitdiagram.com/dwservice/agent
- Repository: https://github.com/dwservice/agent

## Overview

DWService Agent is a cross-platform remote-management and support agent. Its central workflow is to start the agent, establish server communication, accept remote work, and expose supported applications such as desktop, filesystem, shell, and resource monitoring. Core modules also provide listener, IPC, native-platform, and connection services; the repository includes a user-facing installer and monitor UI. Application dispatch and several UI interactions are inferred from the product structure, so those links are marked unverified rather than presented as inspected call paths.

Main entry points: [`core/agent.py`](https://github.com/dwservice/agent/blob/master/core/agent.py) (Agent manager), [`app_desktop/desktop.py`](https://github.com/dwservice/agent/blob/master/app_desktop/desktop.py) (Remote desktop), [`ui/installer.py`](https://github.com/dwservice/agent/blob/master/ui/installer.py) (Installer UI), [`app_shell/shell.py`](https://github.com/dwservice/agent/blob/master/app_shell/shell.py) (Remote shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_agent["Agent manager<br/>[agent.py]"]
  node_communication["Server communication<br/>[communication.py]"]
  node_listener["Connection listener<br/>[listener.py]"]
  node_ipc["Process IPC<br/>[ipc.py]"]
  node_applications["App registry<br/>[applications.py]"]
end

subgraph group_apps["Remote applications"]
  node_desktop["Remote desktop<br/>[desktop.py]"]
  node_encoder["Frame encoding<br/>[encoder.py]"]
  node_filesystem["File management<br/>[filesystem.py]"]
  node_shell["Remote shell<br/>[shell.py]"]
  node_pty["Windows console<br/>[conpty.py]"]
  node_texteditor["Text editor<br/>[texteditor.py]"]
  node_logwatch["Log watch<br/>[logwatch.py]"]
  node_resource["Resource monitor<br/>[resource.py]"]
end

subgraph group_native["Platform capabilities"]
  node_nativebridge["Native bridge<br/>[native.py]"]
  node_capture["Screen capture<br/>[main.cpp]"]
  node_osutil["OS utilities<br/>[main.h]"]
end

subgraph group_ui["User interface"]
  node_ui["Agent UI<br/>[ui.py]"]
  node_installer["Installer UI<br/>[installer.py]"]
  node_monitor["Monitor UI<br/>[monitor.py]"]
  node_gdi["GUI backend<br/>[gdi.py]"]
end

subgraph group_services["Agent services"]
  node_detectinfo["Platform detection<br/>[detectinfo.py]"]
  node_utils["Core utilities<br/>[utils.py]"]
  node_windows_service["Windows service<br/>[main.cpp]"]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_agent
node_agent -->|"uses"| node_communication
node_agent -->|"uses"| node_listener
node_agent -->|"initializes"| node_ipc
node_agent -->|"queries"| node_applications
node_agent -->|"queries"| node_detectinfo
node_agent -->|"uses"| node_utils
node_listener -->|"uses"| node_ipc
node_communication -->|"uses"| node_utils
node_desktop -->|"uses"| node_agent
node_desktop -->|"uses"| node_ipc
node_desktop -->|"uses"| node_nativebridge
node_shell -->|"uses"| node_agent
node_shell -->|"uses"| node_nativebridge
node_shell -->|"uses"| node_pty
node_resource -->|"uses"| node_agent
node_installer -.->|"uses"| node_communication
node_installer -.->|"uses"| node_listener
node_installer -.->|"uses"| node_ipc
node_installer -.->|"uses"| node_ui
node_installer -.->|"uses"| node_monitor
node_ui -.->|"uses"| node_gdi
node_desktop -.->|"captures with"| node_capture
node_desktop -.->|"encodes with"| node_encoder
node_agent -.->|"dispatches to"| node_filesystem
node_agent -.->|"dispatches to"| node_shell
node_agent -.->|"dispatches to"| node_texteditor
node_agent -.->|"dispatches to"| node_logwatch
node_agent -.->|"dispatches to"| node_resource
node_nativebridge -.->|"calls"| node_osutil
node_agent -.->|"runs as"| node_windows_service

click node_agent "https://github.com/dwservice/agent/blob/master/core/agent.py"
click node_communication "https://github.com/dwservice/agent/blob/master/core/communication.py"
click node_listener "https://github.com/dwservice/agent/blob/master/core/listener.py"
click node_ipc "https://github.com/dwservice/agent/blob/master/core/ipc.py"
click node_applications "https://github.com/dwservice/agent/blob/master/core/applications.py"
click node_detectinfo "https://github.com/dwservice/agent/blob/master/core/detectinfo.py"
click node_utils "https://github.com/dwservice/agent/blob/master/core/utils.py"
click node_nativebridge "https://github.com/dwservice/agent/blob/master/core/native.py"
click node_desktop "https://github.com/dwservice/agent/blob/master/app_desktop/desktop.py"
click node_capture "https://github.com/dwservice/agent/blob/master/lib_screencapture/src/main.cpp"
click node_encoder "https://github.com/dwservice/agent/blob/master/app_desktop/encoder.py"
click node_filesystem "https://github.com/dwservice/agent/blob/master/app_filesystem/filesystem.py"
click node_shell "https://github.com/dwservice/agent/blob/master/app_shell/shell.py"
click node_pty "https://github.com/dwservice/agent/blob/master/app_shell/os_win_pyconpty/conpty.py"
click node_texteditor "https://github.com/dwservice/agent/blob/master/app_texteditor/texteditor.py"
click node_logwatch "https://github.com/dwservice/agent/blob/master/app_logwatch/logwatch.py"
click node_resource "https://github.com/dwservice/agent/blob/master/app_resource/resource.py"
click node_ui "https://github.com/dwservice/agent/blob/master/ui/ui.py"
click node_installer "https://github.com/dwservice/agent/blob/master/ui/installer.py"
click node_monitor "https://github.com/dwservice/agent/blob/master/ui/monitor.py"
click node_gdi "https://github.com/dwservice/agent/blob/master/ui/gdi.py"
click node_osutil "https://github.com/dwservice/agent/blob/master/lib_osutil/src/main.h"
click node_windows_service "https://github.com/dwservice/agent/blob/master/os_win_service/src/main.cpp"

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_agent,node_communication,node_listener,node_ipc,node_applications toneBlue
class node_desktop,node_encoder,node_filesystem,node_shell,node_pty,node_texteditor,node_logwatch,node_resource toneAmber
class node_nativebridge,node_capture,node_osutil toneMint
class node_ui,node_installer,node_monitor,node_gdi toneRose
class node_detectinfo,node_utils,node_windows_service,node_operator toneIndigo
```

## Components

### Agent runtime

- [Agent manager](https://github.com/dwservice/agent/blob/master/core/agent.py): `core/agent.py`
- [Server communication](https://github.com/dwservice/agent/blob/master/core/communication.py): `core/communication.py`
- [Connection listener](https://github.com/dwservice/agent/blob/master/core/listener.py): `core/listener.py`
- [Process IPC](https://github.com/dwservice/agent/blob/master/core/ipc.py): `core/ipc.py`
- [App registry](https://github.com/dwservice/agent/blob/master/core/applications.py): `core/applications.py`

### Remote applications

- [Remote desktop](https://github.com/dwservice/agent/blob/master/app_desktop/desktop.py): `app_desktop/desktop.py`
- [Frame encoding](https://github.com/dwservice/agent/blob/master/app_desktop/encoder.py): `app_desktop/encoder.py`
- [File management](https://github.com/dwservice/agent/blob/master/app_filesystem/filesystem.py): `app_filesystem/filesystem.py`
- [Remote shell](https://github.com/dwservice/agent/blob/master/app_shell/shell.py): `app_shell/shell.py`
- [Windows console](https://github.com/dwservice/agent/blob/master/app_shell/os_win_pyconpty/conpty.py): `app_shell/os_win_pyconpty/conpty.py`
- [Text editor](https://github.com/dwservice/agent/blob/master/app_texteditor/texteditor.py): `app_texteditor/texteditor.py`
- [Log watch](https://github.com/dwservice/agent/blob/master/app_logwatch/logwatch.py): `app_logwatch/logwatch.py`
- [Resource monitor](https://github.com/dwservice/agent/blob/master/app_resource/resource.py): `app_resource/resource.py`

### Platform capabilities

- [Native bridge](https://github.com/dwservice/agent/blob/master/core/native.py): `core/native.py`
- [Screen capture](https://github.com/dwservice/agent/blob/master/lib_screencapture/src/main.cpp): `lib_screencapture/src/main.cpp`
- [OS utilities](https://github.com/dwservice/agent/blob/master/lib_osutil/src/main.h): `lib_osutil/src/main.h`

### User interface

- [Agent UI](https://github.com/dwservice/agent/blob/master/ui/ui.py): `ui/ui.py`
- [Installer UI](https://github.com/dwservice/agent/blob/master/ui/installer.py): `ui/installer.py`
- [Monitor UI](https://github.com/dwservice/agent/blob/master/ui/monitor.py): `ui/monitor.py`
- [GUI backend](https://github.com/dwservice/agent/blob/master/ui/gdi.py): `ui/gdi.py`

### Agent services

- [Platform detection](https://github.com/dwservice/agent/blob/master/core/detectinfo.py): `core/detectinfo.py`
- [Core utilities](https://github.com/dwservice/agent/blob/master/core/utils.py): `core/utils.py`
- [Windows service](https://github.com/dwservice/agent/blob/master/os_win_service/src/main.cpp): `os_win_service/src/main.cpp`

### Other components

- **Operator**

## Connections

- Operator → Agent manager: starts (evidence: `README.md`)
- Agent manager → Server communication: uses (evidence: `core/agent.py`)
- Agent manager → Connection listener: uses (evidence: `core/agent.py`)
- Agent manager → Process IPC: initializes (evidence: `core/agent.py`)
- Agent manager → App registry: queries (evidence: `core/agent.py`)
- Agent manager → Platform detection: queries (evidence: `core/agent.py`)
- Agent manager → Core utilities: uses (evidence: `core/agent.py`)
- Connection listener → Process IPC: uses (evidence: `core/listener.py`)
- Server communication → Core utilities: uses (evidence: `core/communication.py`)
- Remote desktop → Agent manager: uses (evidence: `app_desktop/desktop.py`)
- Remote desktop → Process IPC: uses (evidence: `app_desktop/desktop.py`)
- Remote desktop → Native bridge: uses (evidence: `app_desktop/desktop.py`)
- Remote shell → Agent manager: uses (evidence: `app_shell/shell.py`)
- Remote shell → Native bridge: uses (evidence: `app_shell/shell.py`)
- Remote shell → Windows console: uses (evidence: `app_shell/shell.py`)
- Resource monitor → Agent manager: uses (evidence: `app_resource/resource.py`)
- Installer UI → Server communication: uses (evidence: `ui/installer.py`)
- Installer UI → Connection listener: uses (evidence: `ui/installer.py`)
- Installer UI → Process IPC: uses (evidence: `ui/installer.py`)
- Installer UI → Agent UI: uses (evidence: `ui/installer.py`)
- Installer UI → Monitor UI: uses (evidence: `ui/installer.py`)
- Agent UI → GUI backend: uses
- Remote desktop → Screen capture: captures with
- Remote desktop → Frame encoding: encodes with
- Agent manager → File management: dispatches to
- Agent manager → Remote shell: dispatches to (evidence: `app_shell/shell.py`)
- Agent manager → Text editor: dispatches to
- Agent manager → Log watch: dispatches to
- Agent manager → Resource monitor: dispatches to (evidence: `app_resource/resource.py`)
- Native bridge → OS utilities: calls
- Agent manager → Windows service: runs as
