vadgr-computer-use 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vadgr_computer_use-0.1.0/LICENSE +190 -0
- vadgr_computer_use-0.1.0/NOTICE +11 -0
- vadgr_computer_use-0.1.0/PKG-INFO +156 -0
- vadgr_computer_use-0.1.0/README.md +122 -0
- vadgr_computer_use-0.1.0/computer_use/__init__.py +50 -0
- vadgr_computer_use-0.1.0/computer_use/__main__.py +134 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/__init__.py +0 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/actions.py +76 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/capture.py +70 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/client.py +187 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/daemon.py +949 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/deployer.py +300 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/protocol.py +40 -0
- vadgr_computer_use-0.1.0/computer_use/bridge/supervisor.py +277 -0
- vadgr_computer_use-0.1.0/computer_use/core/__init__.py +0 -0
- vadgr_computer_use-0.1.0/computer_use/core/actions.py +94 -0
- vadgr_computer_use-0.1.0/computer_use/core/engine.py +220 -0
- vadgr_computer_use-0.1.0/computer_use/core/errors.py +29 -0
- vadgr_computer_use-0.1.0/computer_use/core/loop.py +183 -0
- vadgr_computer_use-0.1.0/computer_use/core/screenshot.py +43 -0
- vadgr_computer_use-0.1.0/computer_use/core/smooth_move.py +259 -0
- vadgr_computer_use-0.1.0/computer_use/core/types.py +92 -0
- vadgr_computer_use-0.1.0/computer_use/mcp_server.py +389 -0
- vadgr_computer_use-0.1.0/computer_use/platform/__init__.py +0 -0
- vadgr_computer_use-0.1.0/computer_use/platform/base.py +51 -0
- vadgr_computer_use-0.1.0/computer_use/platform/detect.py +74 -0
- vadgr_computer_use-0.1.0/computer_use/platform/linux.py +1352 -0
- vadgr_computer_use-0.1.0/computer_use/platform/macos.py +407 -0
- vadgr_computer_use-0.1.0/computer_use/platform/windows.py +407 -0
- vadgr_computer_use-0.1.0/computer_use/platform/wsl2.py +824 -0
- vadgr_computer_use-0.1.0/computer_use/providers/__init__.py +0 -0
- vadgr_computer_use-0.1.0/computer_use/providers/anthropic.py +262 -0
- vadgr_computer_use-0.1.0/computer_use/providers/base.py +57 -0
- vadgr_computer_use-0.1.0/computer_use/providers/openai.py +250 -0
- vadgr_computer_use-0.1.0/computer_use/providers/registry.py +69 -0
- vadgr_computer_use-0.1.0/pyproject.toml +61 -0
- vadgr_computer_use-0.1.0/setup.cfg +4 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/PKG-INFO +156 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/SOURCES.txt +41 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/dependency_links.txt +1 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/entry_points.txt +2 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/requires.txt +10 -0
- vadgr_computer_use-0.1.0/vadgr_computer_use.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Victor Santiago Montaño Diaz
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Vadgr
|
|
2
|
+
Copyright 2026 Victor Santiago Montaño Diaz
|
|
3
|
+
|
|
4
|
+
Vadgr is a platform for AI agents that work on your computer. Describe
|
|
5
|
+
your task, Vadgr builds the agent, and the agent runs autonomously --
|
|
6
|
+
writing code, controlling apps, and delivering results. Works with
|
|
7
|
+
Claude, Codex, Gemini, or any CLI agent tool.
|
|
8
|
+
|
|
9
|
+
https://github.com/MONTBRAIN/vadgr
|
|
10
|
+
|
|
11
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vadgr-computer-use
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first MCP server for desktop automation (accessibility + vision)
|
|
5
|
+
Author: Santiago Montaño Diaz
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/MONTBRAIN/vadgr-computer-use
|
|
8
|
+
Project-URL: Repository, https://github.com/MONTBRAIN/vadgr-computer-use
|
|
9
|
+
Project-URL: Issues, https://github.com/MONTBRAIN/vadgr-computer-use/issues
|
|
10
|
+
Keywords: mcp,computer-use,automation,accessibility,agent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Operating System :: MacOS
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: NOTICE
|
|
24
|
+
Requires-Dist: mcp>=1.0
|
|
25
|
+
Requires-Dist: pillow>=10
|
|
26
|
+
Requires-Dist: pyyaml>=6
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: mss>=9
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# vadgr-computer-use
|
|
36
|
+
|
|
37
|
+
Local MCP server for desktop automation — 13 tools for capture, mouse, keyboard, and platform introspection.
|
|
38
|
+
|
|
39
|
+
The LLM takes screenshots, reasons over them, and drives mouse and keyboard through the server. The model picks coordinates directly from the pixels.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install vadgr-computer-use
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Run as MCP server
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
vadgr-cua # stdio (default) -- what MCP clients use
|
|
51
|
+
vadgr-cua --transport sse --port 8000 # SSE variant
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Wire it into any MCP client (Claude Desktop, Cursor, Cline, custom agents).
|
|
55
|
+
|
|
56
|
+
## How it works
|
|
57
|
+
|
|
58
|
+
The loop is intentionally simple:
|
|
59
|
+
|
|
60
|
+
1. Agent calls `screenshot()` — server returns a downscaled PNG.
|
|
61
|
+
2. Agent reasons over the image and picks coordinates.
|
|
62
|
+
3. Agent calls `click(x, y)` / `type_text(...)` / `key_press(...)`.
|
|
63
|
+
4. Agent calls `screenshot()` again to verify the effect.
|
|
64
|
+
|
|
65
|
+
That's it. The LLM owns the "where to click" decision; the server owns "how to click it precisely". No other abstraction in between.
|
|
66
|
+
|
|
67
|
+
## Platform support
|
|
68
|
+
|
|
69
|
+
| Platform | Screenshots | Mouse / keyboard | Status |
|
|
70
|
+
|----------|-------------|------------------|--------|
|
|
71
|
+
| WSL2 → Windows host | TCP bridge daemon (`mss` on Windows) | TCP bridge daemon (Win32 `SendInput`) | primary, well-tested |
|
|
72
|
+
| Linux / X11 | `mss` | `xdotool` | works |
|
|
73
|
+
| Windows native | Win32 GDI | SendInput | should work; not part of the v0.1.0 test matrix |
|
|
74
|
+
| macOS | `screencapture` | `osascript` / `cliclick` | WIP, not functional yet |
|
|
75
|
+
|
|
76
|
+
macOS is a work-in-progress: the backend imports but actions and screenshots do not round-trip correctly yet. Fixes welcome.
|
|
77
|
+
|
|
78
|
+
On WSL2 the bridge daemon is launched automatically on first use and persists across MCP sessions; if it can't be started (e.g. no Windows Python available), the server silently falls back to a slower PowerShell path. See [Daemon management](#daemon-management-wsl2) below.
|
|
79
|
+
|
|
80
|
+
## MCP tools (13)
|
|
81
|
+
|
|
82
|
+
Capture (2)
|
|
83
|
+
- `screenshot()` — full screen, downscaled to `CU_MAX_WIDTH` (auto-picks 1024 / 1280 / 1366).
|
|
84
|
+
- `screenshot_region(x, y, w, h)` — cropped region.
|
|
85
|
+
|
|
86
|
+
Input (8)
|
|
87
|
+
- `click(x, y)` / `double_click(x, y)` / `right_click(x, y)`
|
|
88
|
+
- `move_mouse(x, y)` / `drag(start_x, start_y, end_x, end_y, duration=0.5)`
|
|
89
|
+
- `scroll(x, y, amount)` — positive = up, negative = down
|
|
90
|
+
- `type_text(text)` / `key_press(keys)` — keys like `ctrl+s`, `alt+tab`, `enter`
|
|
91
|
+
|
|
92
|
+
Platform info (3)
|
|
93
|
+
- `get_platform()` / `get_platform_info()` / `get_screen_size()`
|
|
94
|
+
|
|
95
|
+
## Daemon management (WSL2)
|
|
96
|
+
|
|
97
|
+
On WSL2 the server reaches Windows through a small background daemon that
|
|
98
|
+
launches on first use and survives across MCP sessions — most users never
|
|
99
|
+
need to touch it. For when you do:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
vadgr-cua doctor # JSON: platform, Windows Python, daemon state, port, hash
|
|
103
|
+
vadgr-cua install-daemon # Eager deploy + launch (useful in provisioning scripts)
|
|
104
|
+
vadgr-cua stop-daemon # Kill the running daemon
|
|
105
|
+
vadgr-cua restart-daemon # Stop then start
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The daemon file is deployed to `%USERPROFILE%\vadgr\daemon.py` and listens on TCP `127.0.0.1:19542`. After `pip install -U vadgr-computer-use`, the next MCP session detects the version-hash drift via a `ping` handshake and redeploys the daemon automatically — no manual restart required.
|
|
109
|
+
|
|
110
|
+
## Library usage
|
|
111
|
+
|
|
112
|
+
Direct (agent picks what to do):
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from computer_use import ComputerUseEngine
|
|
116
|
+
|
|
117
|
+
engine = ComputerUseEngine()
|
|
118
|
+
shot = engine.screenshot()
|
|
119
|
+
engine.click(500, 300)
|
|
120
|
+
engine.type_text("hello")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Autonomous (engine drives itself via an LLM provider — optional):
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
engine = ComputerUseEngine(provider="anthropic") # reads ANTHROPIC_API_KEY
|
|
127
|
+
results = engine.run_task("Open Notepad and type hello", max_steps=50)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Environment
|
|
131
|
+
|
|
132
|
+
| Variable | Purpose |
|
|
133
|
+
|----------|---------|
|
|
134
|
+
| `CU_MAX_WIDTH` | Override screenshot downscale target (default: auto 1024/1280/1366) |
|
|
135
|
+
| `CUE_BRIDGE_PORT` | Override WSL2 bridge daemon TCP port (default: 19542) |
|
|
136
|
+
| `VADGR_DATA` | Override data directory for debug screenshots |
|
|
137
|
+
| `VADGR_DEBUG` | Set to `1` to dump screenshots to `$VADGR_DATA/screenshots/` |
|
|
138
|
+
| `ANTHROPIC_API_KEY` | Only for autonomous mode (`provider="anthropic"`) |
|
|
139
|
+
| `OPENAI_API_KEY` | Only for autonomous mode (`provider="openai"`) |
|
|
140
|
+
|
|
141
|
+
## Tests
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pip install -e ".[dev]"
|
|
145
|
+
pytest computer_use/tests
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
Apache 2.0. See `LICENSE`.
|
|
151
|
+
|
|
152
|
+
## Part of Vadgr
|
|
153
|
+
|
|
154
|
+
- [vadgr](https://github.com/MONTBRAIN/vadgr) — workflow engine (brain)
|
|
155
|
+
- **[vadgr-computer-use](https://github.com/MONTBRAIN/vadgr-computer-use)** — desktop automation MCP (eyes)
|
|
156
|
+
- [vadgr-agent-os](https://github.com/MONTBRAIN/vadgr-agent-os) — containerized agent runtime
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# vadgr-computer-use
|
|
2
|
+
|
|
3
|
+
Local MCP server for desktop automation — 13 tools for capture, mouse, keyboard, and platform introspection.
|
|
4
|
+
|
|
5
|
+
The LLM takes screenshots, reasons over them, and drives mouse and keyboard through the server. The model picks coordinates directly from the pixels.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install vadgr-computer-use
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Run as MCP server
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
vadgr-cua # stdio (default) -- what MCP clients use
|
|
17
|
+
vadgr-cua --transport sse --port 8000 # SSE variant
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Wire it into any MCP client (Claude Desktop, Cursor, Cline, custom agents).
|
|
21
|
+
|
|
22
|
+
## How it works
|
|
23
|
+
|
|
24
|
+
The loop is intentionally simple:
|
|
25
|
+
|
|
26
|
+
1. Agent calls `screenshot()` — server returns a downscaled PNG.
|
|
27
|
+
2. Agent reasons over the image and picks coordinates.
|
|
28
|
+
3. Agent calls `click(x, y)` / `type_text(...)` / `key_press(...)`.
|
|
29
|
+
4. Agent calls `screenshot()` again to verify the effect.
|
|
30
|
+
|
|
31
|
+
That's it. The LLM owns the "where to click" decision; the server owns "how to click it precisely". No other abstraction in between.
|
|
32
|
+
|
|
33
|
+
## Platform support
|
|
34
|
+
|
|
35
|
+
| Platform | Screenshots | Mouse / keyboard | Status |
|
|
36
|
+
|----------|-------------|------------------|--------|
|
|
37
|
+
| WSL2 → Windows host | TCP bridge daemon (`mss` on Windows) | TCP bridge daemon (Win32 `SendInput`) | primary, well-tested |
|
|
38
|
+
| Linux / X11 | `mss` | `xdotool` | works |
|
|
39
|
+
| Windows native | Win32 GDI | SendInput | should work; not part of the v0.1.0 test matrix |
|
|
40
|
+
| macOS | `screencapture` | `osascript` / `cliclick` | WIP, not functional yet |
|
|
41
|
+
|
|
42
|
+
macOS is a work-in-progress: the backend imports but actions and screenshots do not round-trip correctly yet. Fixes welcome.
|
|
43
|
+
|
|
44
|
+
On WSL2 the bridge daemon is launched automatically on first use and persists across MCP sessions; if it can't be started (e.g. no Windows Python available), the server silently falls back to a slower PowerShell path. See [Daemon management](#daemon-management-wsl2) below.
|
|
45
|
+
|
|
46
|
+
## MCP tools (13)
|
|
47
|
+
|
|
48
|
+
Capture (2)
|
|
49
|
+
- `screenshot()` — full screen, downscaled to `CU_MAX_WIDTH` (auto-picks 1024 / 1280 / 1366).
|
|
50
|
+
- `screenshot_region(x, y, w, h)` — cropped region.
|
|
51
|
+
|
|
52
|
+
Input (8)
|
|
53
|
+
- `click(x, y)` / `double_click(x, y)` / `right_click(x, y)`
|
|
54
|
+
- `move_mouse(x, y)` / `drag(start_x, start_y, end_x, end_y, duration=0.5)`
|
|
55
|
+
- `scroll(x, y, amount)` — positive = up, negative = down
|
|
56
|
+
- `type_text(text)` / `key_press(keys)` — keys like `ctrl+s`, `alt+tab`, `enter`
|
|
57
|
+
|
|
58
|
+
Platform info (3)
|
|
59
|
+
- `get_platform()` / `get_platform_info()` / `get_screen_size()`
|
|
60
|
+
|
|
61
|
+
## Daemon management (WSL2)
|
|
62
|
+
|
|
63
|
+
On WSL2 the server reaches Windows through a small background daemon that
|
|
64
|
+
launches on first use and survives across MCP sessions — most users never
|
|
65
|
+
need to touch it. For when you do:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
vadgr-cua doctor # JSON: platform, Windows Python, daemon state, port, hash
|
|
69
|
+
vadgr-cua install-daemon # Eager deploy + launch (useful in provisioning scripts)
|
|
70
|
+
vadgr-cua stop-daemon # Kill the running daemon
|
|
71
|
+
vadgr-cua restart-daemon # Stop then start
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The daemon file is deployed to `%USERPROFILE%\vadgr\daemon.py` and listens on TCP `127.0.0.1:19542`. After `pip install -U vadgr-computer-use`, the next MCP session detects the version-hash drift via a `ping` handshake and redeploys the daemon automatically — no manual restart required.
|
|
75
|
+
|
|
76
|
+
## Library usage
|
|
77
|
+
|
|
78
|
+
Direct (agent picks what to do):
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from computer_use import ComputerUseEngine
|
|
82
|
+
|
|
83
|
+
engine = ComputerUseEngine()
|
|
84
|
+
shot = engine.screenshot()
|
|
85
|
+
engine.click(500, 300)
|
|
86
|
+
engine.type_text("hello")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Autonomous (engine drives itself via an LLM provider — optional):
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
engine = ComputerUseEngine(provider="anthropic") # reads ANTHROPIC_API_KEY
|
|
93
|
+
results = engine.run_task("Open Notepad and type hello", max_steps=50)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Environment
|
|
97
|
+
|
|
98
|
+
| Variable | Purpose |
|
|
99
|
+
|----------|---------|
|
|
100
|
+
| `CU_MAX_WIDTH` | Override screenshot downscale target (default: auto 1024/1280/1366) |
|
|
101
|
+
| `CUE_BRIDGE_PORT` | Override WSL2 bridge daemon TCP port (default: 19542) |
|
|
102
|
+
| `VADGR_DATA` | Override data directory for debug screenshots |
|
|
103
|
+
| `VADGR_DEBUG` | Set to `1` to dump screenshots to `$VADGR_DATA/screenshots/` |
|
|
104
|
+
| `ANTHROPIC_API_KEY` | Only for autonomous mode (`provider="anthropic"`) |
|
|
105
|
+
| `OPENAI_API_KEY` | Only for autonomous mode (`provider="openai"`) |
|
|
106
|
+
|
|
107
|
+
## Tests
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install -e ".[dev]"
|
|
111
|
+
pytest computer_use/tests
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
Apache 2.0. See `LICENSE`.
|
|
117
|
+
|
|
118
|
+
## Part of Vadgr
|
|
119
|
+
|
|
120
|
+
- [vadgr](https://github.com/MONTBRAIN/vadgr) — workflow engine (brain)
|
|
121
|
+
- **[vadgr-computer-use](https://github.com/MONTBRAIN/vadgr-computer-use)** — desktop automation MCP (eyes)
|
|
122
|
+
- [vadgr-agent-os](https://github.com/MONTBRAIN/vadgr-agent-os) — containerized agent runtime
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Computer Use Engine -- gives LLM agents eyes and hands.
|
|
2
|
+
|
|
3
|
+
Library mode (agent calls engine):
|
|
4
|
+
from computer_use import ComputerUseEngine
|
|
5
|
+
engine = ComputerUseEngine()
|
|
6
|
+
screen = engine.screenshot()
|
|
7
|
+
engine.click(500, 300)
|
|
8
|
+
engine.type_text("hello")
|
|
9
|
+
|
|
10
|
+
Autonomous mode (engine calls LLM):
|
|
11
|
+
from computer_use import ComputerUseEngine
|
|
12
|
+
engine = ComputerUseEngine(provider="anthropic")
|
|
13
|
+
results = engine.run_task("Open Notepad and type hello")
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from computer_use.core.engine import ComputerUseEngine
|
|
17
|
+
from computer_use.core.errors import (
|
|
18
|
+
ActionError,
|
|
19
|
+
ActionTimeoutError,
|
|
20
|
+
ComputerUseError,
|
|
21
|
+
ConfigError,
|
|
22
|
+
PlatformNotSupportedError,
|
|
23
|
+
ProviderError,
|
|
24
|
+
ScreenCaptureError,
|
|
25
|
+
)
|
|
26
|
+
from computer_use.core.types import (
|
|
27
|
+
Action,
|
|
28
|
+
ActionType,
|
|
29
|
+
Platform,
|
|
30
|
+
Region,
|
|
31
|
+
ScreenState,
|
|
32
|
+
StepResult,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
"ComputerUseEngine",
|
|
37
|
+
"Action",
|
|
38
|
+
"ActionType",
|
|
39
|
+
"Platform",
|
|
40
|
+
"Region",
|
|
41
|
+
"ScreenState",
|
|
42
|
+
"StepResult",
|
|
43
|
+
"ComputerUseError",
|
|
44
|
+
"ScreenCaptureError",
|
|
45
|
+
"ActionError",
|
|
46
|
+
"ActionTimeoutError",
|
|
47
|
+
"ProviderError",
|
|
48
|
+
"ConfigError",
|
|
49
|
+
"PlatformNotSupportedError",
|
|
50
|
+
]
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""CLI entry point for autonomous mode.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
python -m computer_use "Open Chrome and search for Vadgr"
|
|
5
|
+
python -m computer_use --provider anthropic "Open Notepad"
|
|
6
|
+
python -m computer_use --config custom.yaml "Click the Start menu"
|
|
7
|
+
python -m computer_use --info # Show platform info
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import logging
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
parser = argparse.ArgumentParser(
|
|
17
|
+
description="Computer Use Engine -- autonomous desktop control."
|
|
18
|
+
)
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"task",
|
|
21
|
+
nargs="?",
|
|
22
|
+
help="Natural-language task description.",
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--provider",
|
|
26
|
+
default=None,
|
|
27
|
+
help="LLM provider (anthropic, openai).",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--config",
|
|
31
|
+
default=None,
|
|
32
|
+
help="Path to config.yaml.",
|
|
33
|
+
)
|
|
34
|
+
parser.add_argument(
|
|
35
|
+
"--max-steps",
|
|
36
|
+
type=int,
|
|
37
|
+
default=50,
|
|
38
|
+
help="Maximum steps before stopping.",
|
|
39
|
+
)
|
|
40
|
+
parser.add_argument(
|
|
41
|
+
"--no-verify",
|
|
42
|
+
action="store_true",
|
|
43
|
+
help="Skip action verification.",
|
|
44
|
+
)
|
|
45
|
+
parser.add_argument(
|
|
46
|
+
"--info",
|
|
47
|
+
action="store_true",
|
|
48
|
+
help="Show platform info and exit.",
|
|
49
|
+
)
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"--screenshot",
|
|
52
|
+
type=str,
|
|
53
|
+
default=None,
|
|
54
|
+
metavar="PATH",
|
|
55
|
+
help="Take a screenshot and save to PATH.",
|
|
56
|
+
)
|
|
57
|
+
parser.add_argument(
|
|
58
|
+
"--verbose", "-v",
|
|
59
|
+
action="store_true",
|
|
60
|
+
help="Enable debug logging.",
|
|
61
|
+
)
|
|
62
|
+
args = parser.parse_args()
|
|
63
|
+
|
|
64
|
+
logging.basicConfig(
|
|
65
|
+
level=logging.DEBUG if args.verbose else logging.INFO,
|
|
66
|
+
format="%(asctime)s [%(name)s] %(levelname)s: %(message)s",
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
from computer_use.core.engine import ComputerUseEngine
|
|
70
|
+
|
|
71
|
+
# Info mode
|
|
72
|
+
if args.info:
|
|
73
|
+
engine = ComputerUseEngine(config_path=args.config)
|
|
74
|
+
info = engine.get_platform_info()
|
|
75
|
+
print(f"Platform: {info['platform']}")
|
|
76
|
+
print(f"Backend available: {info['backend_available']}")
|
|
77
|
+
print(f"Accessibility API: {info['accessibility']['api_name']}")
|
|
78
|
+
print(f"Accessibility available: {info['accessibility']['available']}")
|
|
79
|
+
if info["accessibility"].get("notes"):
|
|
80
|
+
print(f"Notes: {info['accessibility']['notes']}")
|
|
81
|
+
screen_w, screen_h = engine.get_screen_size()
|
|
82
|
+
print(f"Screen size: {screen_w}x{screen_h}")
|
|
83
|
+
return
|
|
84
|
+
|
|
85
|
+
# Screenshot mode
|
|
86
|
+
if args.screenshot:
|
|
87
|
+
engine = ComputerUseEngine(config_path=args.config)
|
|
88
|
+
screen = engine.screenshot()
|
|
89
|
+
with open(args.screenshot, "wb") as f:
|
|
90
|
+
f.write(screen.image_bytes)
|
|
91
|
+
print(
|
|
92
|
+
f"Screenshot saved to {args.screenshot} "
|
|
93
|
+
f"({screen.width}x{screen.height})"
|
|
94
|
+
)
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
# Task mode (autonomous)
|
|
98
|
+
if not args.task:
|
|
99
|
+
parser.error("A task description is required (or use --info / --screenshot)")
|
|
100
|
+
|
|
101
|
+
provider = args.provider or "anthropic"
|
|
102
|
+
engine = ComputerUseEngine(
|
|
103
|
+
config_path=args.config,
|
|
104
|
+
provider=provider,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
print(f"Platform: {engine.get_platform().value}")
|
|
108
|
+
print(f"Provider: {provider}")
|
|
109
|
+
print(f"Task: {args.task}")
|
|
110
|
+
print(f"Max steps: {args.max_steps}")
|
|
111
|
+
print("---")
|
|
112
|
+
|
|
113
|
+
results = engine.run_task(
|
|
114
|
+
task=args.task,
|
|
115
|
+
max_steps=args.max_steps,
|
|
116
|
+
verify=not args.no_verify,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
print(f"\nCompleted {len(results)} steps.")
|
|
120
|
+
for i, r in enumerate(results, 1):
|
|
121
|
+
status = "OK" if r.success else "FAILED"
|
|
122
|
+
action = r.action_taken.action_type.value
|
|
123
|
+
reason = r.reasoning[:80] if r.reasoning else ""
|
|
124
|
+
print(f" Step {i}: [{status}] {action} -- {reason}")
|
|
125
|
+
if r.error:
|
|
126
|
+
print(f" Error: {r.error}")
|
|
127
|
+
|
|
128
|
+
success_count = sum(1 for r in results if r.success)
|
|
129
|
+
print(f"\n{success_count}/{len(results)} steps succeeded.")
|
|
130
|
+
sys.exit(0 if all(r.success for r in results) else 1)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if __name__ == "__main__":
|
|
134
|
+
main()
|
|
File without changes
|