# kishore2006-kumar/orb---ambient-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/kishore2006-kumar/orb---ambient-intelligence
- Repository: https://github.com/kishore2006-kumar/orb---ambient-intelligence

## Overview

ORB Hub is a FastAPI service for pairing and managing devices, issuing safety-checked commands, and receiving device updates; it includes Android, virtual, iOS-stub, and Windows-agent drivers. A separate Windows agent executes hub-dispatched actions. The graph follows the documented/source-indexed runtime links; unsampled API and agent details are kept at subsystem level, and the README provides no additional capability description.

Main entry points: [`hub/main.py`](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/main.py) (Hub App), [`hub/services/commands.py`](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/commands.py) (Command Execution), [`hub/drivers/registry.py`](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/registry.py) (Driver Registry), [`hub/api/devices.py`](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/devices.py) (Device API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Hub API"]
  node_app["Hub App<br/>[main.py]"]
  node_device_api["Device API<br/>[devices.py]"]
  node_command_api["Command API<br/>[commands.py]"]
  node_websocket["WebSocket API<br/>[ws.py]"]
  node_auth["Token Security<br/>[security.py]"]
end

subgraph group_domain["Device Workflows"]
  node_device_service["Device Management<br/>[devices.py]"]
  node_pairing["Device Pairing<br/>[pairing.py]"]
  node_commands["Command Execution<br/>[commands.py]"]
  node_safety["Safety Validation<br/>[safety.py]"]
end

subgraph group_runtime["Drivers And Messaging"]
  node_drivers["Driver Registry<br/>[registry.py]"]
  node_adb["Android ADB<br/>[adb.py]"]
  node_virtual["Virtual Driver<br/>[virtual.py]"]
  node_ios["iOS Stub<br/>[ios_stub.py]"]
  node_windows_driver["Windows Driver<br/>[windows_agent.py]"]
  node_bus["Message Bus<br/>[base.py]"]
  node_mqtt["MQTT Bus<br/>[mqtt_bus.py]"]
  node_memory_bus["Memory Bus<br/>[memory_bus.py]"]
end

subgraph group_state["Persistence And Events"]
  node_models["Domain Records<br/>[models.py]"]
  node_database[("Relational Database<br/>[session.py]")]
  node_events["Device Events<br/>[events.py]"]
end

subgraph group_agent["Windows Agent"]
  node_agent["Windows Agent<br/>[main.py]"]
  node_agent_actions["Agent Actions<br/>[actions.py]"]
  node_agent_client["Agent Client<br/>[client.py]"]
end

node_user(("API Client"))
node_device(("Managed Device"))

node_user -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_device_api
node_app -->|"mounts routes"| node_command_api
node_app -->|"mounts routes"| node_websocket
node_device_api -->|"checks token"| node_auth
node_command_api -->|"checks token"| node_auth
node_device_api -->|"manages devices"| node_device_service
node_device_api -->|"starts pairing"| node_pairing
node_command_api -->|"submits commands"| node_commands
node_commands -->|"validates actions"| node_safety
node_commands -->|"gets driver"| node_drivers
node_device_service -->|"connects devices"| node_adb
node_drivers -->|"registers driver"| node_adb
node_drivers -->|"registers driver"| node_virtual
node_drivers -->|"registers driver"| node_ios
node_drivers -->|"registers driver"| node_windows_driver
node_windows_driver -->|"publishes commands"| node_bus
node_mqtt -->|"implements interface"| node_bus
node_memory_bus -->|"implements interface"| node_bus
node_commands -->|"writes state events"| node_events
node_app -->|"creates tables"| node_database
node_commands -->|"reads and updates"| node_models
node_device_service -->|"creates device records"| node_models
node_events -->|"stores event records"| node_models
node_agent -->|"dispatches actions"| node_agent_actions
node_agent -->|"uses client"| node_agent_client
node_agent -.->|"controls device"| node_device
node_websocket -.->|"streams updates"| node_user

click node_app "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/main.py"
click node_device_api "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/devices.py"
click node_command_api "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/commands.py"
click node_websocket "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/ws.py"
click node_auth "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/security.py"
click node_device_service "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/devices.py"
click node_pairing "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/pairing.py"
click node_commands "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/commands.py"
click node_safety "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/safety.py"
click node_drivers "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/registry.py"
click node_adb "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/adb.py"
click node_virtual "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/virtual.py"
click node_ios "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/ios_stub.py"
click node_windows_driver "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/windows_agent.py"
click node_bus "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/base.py"
click node_mqtt "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/mqtt_bus.py"
click node_memory_bus "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/memory_bus.py"
click node_models "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/db/models.py"
click node_database "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/db/session.py"
click node_events "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/events.py"
click node_agent "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/main.py"
click node_agent_actions "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/actions.py"
click node_agent_client "https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/client.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_app,node_device_api,node_command_api,node_websocket,node_auth,node_user toneBlue
class node_device_service,node_pairing,node_commands,node_safety toneAmber
class node_drivers,node_adb,node_virtual,node_ios,node_windows_driver,node_bus,node_mqtt,node_memory_bus toneMint
class node_models,node_database,node_events toneRose
class node_agent,node_agent_actions,node_agent_client,node_device toneIndigo
```

## Components

### Hub API

- [Hub App](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/main.py): `hub/main.py`
- [Device API](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/devices.py): `hub/api/devices.py`
- [Command API](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/commands.py): `hub/api/commands.py`
- [WebSocket API](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/api/ws.py): `hub/api/ws.py`
- [Token Security](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/security.py): `hub/security.py`

### Device Workflows

- [Device Management](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/devices.py): `hub/services/devices.py`
- [Device Pairing](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/pairing.py): `hub/services/pairing.py`
- [Command Execution](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/commands.py): `hub/services/commands.py`
- [Safety Validation](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/safety.py): `hub/services/safety.py`

### Drivers And Messaging

- [Driver Registry](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/registry.py): `hub/drivers/registry.py`
- [Android ADB](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/adb.py): `hub/drivers/adb.py`
- [Virtual Driver](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/virtual.py): `hub/drivers/virtual.py`
- [iOS Stub](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/ios_stub.py): `hub/drivers/ios_stub.py`
- [Windows Driver](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/drivers/windows_agent.py): `hub/drivers/windows_agent.py`
- [Message Bus](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/base.py): `hub/bus/base.py`
- [MQTT Bus](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/mqtt_bus.py): `hub/bus/mqtt_bus.py`
- [Memory Bus](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/bus/memory_bus.py): `hub/bus/memory_bus.py`

### Persistence And Events

- [Domain Records](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/db/models.py): `hub/db/models.py`
- [Relational Database](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/db/session.py): `hub/db/session.py`
- [Device Events](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/hub/services/events.py): `hub/services/events.py`

### Windows Agent

- [Windows Agent](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/main.py): `agent_windows/main.py`
- [Agent Actions](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/actions.py): `agent_windows/actions.py`
- [Agent Client](https://github.com/kishore2006-kumar/orb---ambient-intelligence/blob/phase1-hub/agent_windows/client.py): `agent_windows/client.py`

### Other components

- **API Client**
- **Managed Device**

## Connections

- API Client → Hub App: sends requests
- Hub App → Device API: mounts routes (evidence: `hub/main.py`)
- Hub App → Command API: mounts routes (evidence: `hub/main.py`)
- Hub App → WebSocket API: mounts routes (evidence: `hub/main.py`)
- Device API → Token Security: checks token
- Command API → Token Security: checks token
- Device API → Device Management: manages devices (evidence: `hub/api/devices.py`)
- Device API → Device Pairing: starts pairing (evidence: `hub/api/devices.py`)
- Command API → Command Execution: submits commands (evidence: `hub/api/commands.py`)
- Command Execution → Safety Validation: validates actions (evidence: `hub/services/commands.py`)
- Command Execution → Driver Registry: gets driver (evidence: `hub/services/commands.py`)
- Device Management → Android ADB: connects devices (evidence: `hub/services/devices.py`)
- Driver Registry → Android ADB: registers driver (evidence: `hub/drivers/registry.py`)
- Driver Registry → Virtual Driver: registers driver (evidence: `hub/drivers/registry.py`)
- Driver Registry → iOS Stub: registers driver (evidence: `hub/drivers/registry.py`)
- Driver Registry → Windows Driver: registers driver (evidence: `hub/drivers/registry.py`)
- Windows Driver → Message Bus: publishes commands (evidence: `hub/drivers/windows_agent.py`)
- MQTT Bus → Message Bus: implements interface (evidence: `hub/bus/mqtt_bus.py`)
- Memory Bus → Message Bus: implements interface (evidence: `hub/bus/memory_bus.py`)
- Command Execution → Device Events: writes state events (evidence: `hub/services/commands.py`)
- Hub App → Relational Database: creates tables (evidence: `hub/main.py`)
- Command Execution → Domain Records: reads and updates (evidence: `hub/services/commands.py`)
- Device Management → Domain Records: creates device records (evidence: `hub/services/devices.py`)
- Device Events → Domain Records: stores event records (evidence: `hub/services/events.py`)
- Windows Agent → Agent Actions: dispatches actions (evidence: `agent_windows/main.py`)
- Windows Agent → Agent Client: uses client (evidence: `agent_windows/main.py`)
- Windows Agent → Managed Device: controls device
- WebSocket API → API Client: streams updates
