Skip to content

Commit a937ddc

Browse files
committed
fix: make desktop control backend-pluggable to address vendor lock-in
- Refactor core/desktop_control.py into pluggable backend architecture - DesktopBackend abstract base class + HermesComputerUseBackend implementation - DesktopController auto-detects and routes to first available backend - register_backend() allows adding MCP, Claude Desktop, pyautogui, etc. - All desktop functions delegate to active backend; clear error when none available - Update README with backend plugin documentation - All 6 tests pass (6/6)
1 parent 73078d7 commit a937ddc

2 files changed

Lines changed: 637 additions & 467 deletions

File tree

‎README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,32 @@ Risky actions (`click`, `type`, `key`, `drag`) require confirmation (`y/n`) unle
6767

6868
**Note:** Desktop control requires the Hermes agent environment (the `computer_use` tool is only available through the Hermes agent). Running `deskbridge.py desktop ...` outside the Hermes agent will return an error explaining this requirement.
6969

70+
## Pluggable desktop backends
71+
72+
`core.desktop_control` uses a pluggable backend architecture so DeskBridge is
73+
not locked to a single desktop automation vendor:
74+
75+
- `DesktopBackend` — abstract base class; subclass it to add a new backend.
76+
- `HermesComputerUseBackend` — wraps the Hermes `computer_use` tool (cua-driver).
77+
- `DesktopController` — auto-detects available backends and routes calls to the first one.
78+
79+
To add a non-Hermes backend (MCP, Claude Desktop, pyautogui, etc.):
80+
81+
```python
82+
from core.desktop_control import DesktopBackend, register_backend
83+
84+
class MCPDesktopBackend(DesktopBackend):
85+
name = "mcp"
86+
def capture(self, app=None, mode="som"): ...
87+
def click(self, element=None, coordinate=None, app=None, ...): ...
88+
# implement all abstract methods
89+
90+
register_backend(MCPDesktopBackend())
91+
```
92+
93+
Register backends before calling any desktop function. The controller tries
94+
backends in registration order and uses the first available one.
95+
7096
## Completed
7197
- [x] Blender render wrapper
7298
- [x] Core loader + confirmation

0 commit comments

Comments
 (0)