# jimhasaburger/vmshare architecture

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

- Interactive diagram: https://gitdiagram.com/jimhasaburger/vmshare
- Repository: https://github.com/jimhasaburger/vmshare

## Overview

VMshare is a Windows VM remote-access agent intended to let users interact through a browser, providing screen/audio streaming and mouse input. The visible runtime workflow is browser connection to the agent, which streams encoded VM media and forwards mouse events through a VirtualBox session. The repository contains no browser client, so its UI and client-side protocol handling are not represented. The main implementation is concentrated in agent.py and vm_session.py; unsampled configuration details are kept limited to the existing config file.

Main entry points: [`agent.py`](https://github.com/jimhasaburger/vmshare/blob/main/agent.py) (Stream handler), [`vm_session.py`](https://github.com/jimhasaburger/vmshare/blob/main/vm_session.py) (VM session), [`config.json`](https://github.com/jimhasaburger/vmshare/blob/main/config.json) (Agent configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent services"]
  node_config["Agent configuration<br/>[config.json]"]
  node_http["Info API<br/>[agent.py]"]
  node_flask["HTTP server<br/>[agent.py]"]
  node_wsserver["WebSocket servers<br/>[agent.py]"]
  node_mousehandler["Mouse input handler<br/>[agent.py]"]
end

subgraph group_vm["VM access"]
  node_session["VM session<br/>[vm_session.py]"]
end

subgraph group_media["Media capture"]
  node_streamhandler["Stream handler<br/>[agent.py]"]
  node_video["Video encoding<br/>[agent.py]"]
  node_audio["Audio capture and encoding<br/>[agent.py]"]
end

node_browser(("Browser user"))
node_vm["VirtualBox VM"]
node_audio_device["VB-Cable device"]

node_browser -.->|"requests info"| node_http
node_browser -.->|"connects for streaming and input"| node_wsserver
node_config -->|"configures"| node_http
node_config -->|"configures"| node_wsserver
node_flask -->|"routes"| node_http
node_wsserver -->|"serves"| node_streamhandler
node_wsserver -->|"serves"| node_mousehandler
node_http -->|"reads status"| node_session
node_mousehandler -->|"forwards mouse events"| node_session
node_streamhandler -->|"captures frames and resolution"| node_session
node_streamhandler -->|"encodes frames"| node_video
node_streamhandler -->|"captures and encodes audio"| node_audio
node_audio -->|"reads audio"| node_audio_device
node_session -->|"connects and controls"| node_vm
node_video -->|"sends video packets"| node_browser
node_audio -->|"sends audio packets"| node_browser

click node_config "https://github.com/jimhasaburger/vmshare/blob/main/config.json"
click node_http "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_flask "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_wsserver "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_mousehandler "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_streamhandler "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_video "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_audio "https://github.com/jimhasaburger/vmshare/blob/main/agent.py"
click node_session "https://github.com/jimhasaburger/vmshare/blob/main/vm_session.py"

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_config,node_http,node_flask,node_wsserver,node_mousehandler,node_browser toneBlue
class node_session toneAmber
class node_streamhandler,node_video,node_audio toneMint
class node_vm,node_audio_device toneIndigo
```

## Components

### Agent services

- [Agent configuration](https://github.com/jimhasaburger/vmshare/blob/main/config.json): `config.json`
- [Info API](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`
- [HTTP server](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`
- [WebSocket servers](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`
- [Mouse input handler](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`

### VM access

- [VM session](https://github.com/jimhasaburger/vmshare/blob/main/vm_session.py): `vm_session.py`

### Media capture

- [Stream handler](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`
- [Video encoding](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`
- [Audio capture and encoding](https://github.com/jimhasaburger/vmshare/blob/main/agent.py): `agent.py`

### Other components

- **Browser user**
- **VirtualBox VM**
- **VB-Cable device**

## Connections

- Browser user → Info API: requests info (evidence: `README.md`)
- Browser user → WebSocket servers: connects for streaming and input (evidence: `README.md`)
- Agent configuration → Info API: configures (evidence: `agent.py`)
- Agent configuration → WebSocket servers: configures (evidence: `agent.py`)
- HTTP server → Info API: routes (evidence: `agent.py`)
- WebSocket servers → Stream handler: serves (evidence: `agent.py`)
- WebSocket servers → Mouse input handler: serves (evidence: `agent.py`)
- Info API → VM session: reads status (evidence: `agent.py`)
- Mouse input handler → VM session: forwards mouse events (evidence: `agent.py`)
- Stream handler → VM session: captures frames and resolution (evidence: `agent.py`)
- Stream handler → Video encoding: encodes frames (evidence: `agent.py`)
- Stream handler → Audio capture and encoding: captures and encodes audio (evidence: `agent.py`)
- Audio capture and encoding → VB-Cable device: reads audio (evidence: `agent.py`)
- VM session → VirtualBox VM: connects and controls (evidence: `vm_session.py`)
- Video encoding → Browser user: sends video packets (evidence: `agent.py`)
- Audio capture and encoding → Browser user: sends audio packets (evidence: `agent.py`)
