computeruseprotocol 0.1.0__py3-none-any.whl
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.
- computeruseprotocol-0.1.0.dist-info/METADATA +225 -0
- computeruseprotocol-0.1.0.dist-info/RECORD +27 -0
- computeruseprotocol-0.1.0.dist-info/WHEEL +4 -0
- computeruseprotocol-0.1.0.dist-info/entry_points.txt +3 -0
- computeruseprotocol-0.1.0.dist-info/licenses/LICENSE +21 -0
- cup/__init__.py +548 -0
- cup/__main__.py +222 -0
- cup/_base.py +123 -0
- cup/_router.py +63 -0
- cup/actions/__init__.py +9 -0
- cup/actions/_handler.py +62 -0
- cup/actions/_keys.py +56 -0
- cup/actions/_linux.py +1008 -0
- cup/actions/_macos.py +1090 -0
- cup/actions/_web.py +555 -0
- cup/actions/_windows.py +984 -0
- cup/actions/executor.py +162 -0
- cup/format.py +653 -0
- cup/mcp/__init__.py +1 -0
- cup/mcp/__main__.py +11 -0
- cup/mcp/server.py +418 -0
- cup/platforms/__init__.py +0 -0
- cup/platforms/linux.py +1060 -0
- cup/platforms/macos.py +1005 -0
- cup/platforms/web.py +1009 -0
- cup/platforms/windows.py +935 -0
- cup/search.py +583 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: computeruseprotocol
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the Computer Use Protocol — universal cross-platform UI accessibility
|
|
5
|
+
Project-URL: Homepage, https://computeruseprotocol.com
|
|
6
|
+
Project-URL: Repository, https://github.com/computeruseprotocol/python-sdk
|
|
7
|
+
Project-URL: Specification, https://github.com/computeruseprotocol/computeruseprotocol
|
|
8
|
+
Project-URL: Documentation, https://computeruseprotocol.com
|
|
9
|
+
Author-email: CUP Contributors <cup@computeruseprotocol.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: accessibility,ai-agents,aria,computer-use,ui-automation
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
+
Classifier: Topic :: Software Development :: Testing
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: comtypes>=1.2; sys_platform == 'win32'
|
|
28
|
+
Requires-Dist: pyobjc-framework-applicationservices>=10.0; sys_platform == 'darwin'
|
|
29
|
+
Requires-Dist: pyobjc-framework-cocoa>=10.0; sys_platform == 'darwin'
|
|
30
|
+
Requires-Dist: pyobjc-framework-quartz>=10.0; sys_platform == 'darwin'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: jsonschema>=4.20; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy>=1.13; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
37
|
+
Provides-Extra: mcp
|
|
38
|
+
Requires-Dist: mcp>=1.6; extra == 'mcp'
|
|
39
|
+
Requires-Dist: mss>=6.0; extra == 'mcp'
|
|
40
|
+
Provides-Extra: screenshot
|
|
41
|
+
Requires-Dist: mss>=6.0; extra == 'screenshot'
|
|
42
|
+
Provides-Extra: web
|
|
43
|
+
Requires-Dist: websocket-client>=1.6; extra == 'web'
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="https://computeruseprotocol.com">
|
|
48
|
+
<img src="assets/banner.png" alt="Computer Use Protocol">
|
|
49
|
+
</a>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<b>Python SDK for the Computer Use Protocol</b>
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
<br>
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<a href="https://pypi.org/project/computeruseprotocol"><img src="https://img.shields.io/pypi/v/computeruseprotocol?style=for-the-badge&color=FF6F61&labelColor=000000" alt="PyPI"></a>
|
|
60
|
+
<a href="https://github.com/computeruseprotocol/python-sdk/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-0cc0df?style=for-the-badge&labelColor=000000" alt="MIT License"></a>
|
|
61
|
+
<a href="https://github.com/computeruseprotocol/computeruseprotocol"><img src="https://img.shields.io/badge/Spec-computer--use--protocol-7ed957?style=for-the-badge&labelColor=000000" alt="Spec"></a>
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
The official Python SDK for the [Computer Use Protocol (CUP)](https://github.com/computeruseprotocol/computeruseprotocol) — a universal protocol for AI agents to perceive and interact with any desktop UI. This package provides tree capture, action execution, semantic search, and an MCP server for AI agent integration.
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install computeruseprotocol
|
|
70
|
+
|
|
71
|
+
# Linux additionally requires system packages
|
|
72
|
+
sudo apt install python3-gi gir1.2-atspi-2.0
|
|
73
|
+
|
|
74
|
+
# Web adapter (Chrome DevTools Protocol, works on any OS)
|
|
75
|
+
pip install computeruseprotocol[web]
|
|
76
|
+
|
|
77
|
+
# Screenshot support (mss; not needed on macOS)
|
|
78
|
+
pip install computeruseprotocol[screenshot]
|
|
79
|
+
|
|
80
|
+
# MCP server for AI agent integration
|
|
81
|
+
pip install computeruseprotocol[mcp]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Quick start
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import cup
|
|
88
|
+
|
|
89
|
+
# Snapshot the foreground window — optimized for LLM context windows
|
|
90
|
+
screen = cup.snapshot()
|
|
91
|
+
print(screen)
|
|
92
|
+
|
|
93
|
+
# All windows
|
|
94
|
+
screen = cup.snapshot("full")
|
|
95
|
+
|
|
96
|
+
# Structured CUP envelope (dict) instead of compact text
|
|
97
|
+
envelope = cup.snapshot_raw()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Output:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
# CUP 0.1.0 | windows | 2560x1440
|
|
104
|
+
# app: Spotify
|
|
105
|
+
# 63 nodes (280 before pruning)
|
|
106
|
+
|
|
107
|
+
[e0] win "Spotify" 120,40 1680x1020
|
|
108
|
+
[e1] doc "Spotify" 120,40 1680x1020
|
|
109
|
+
[e2] btn "Back" 132,52 32x32 [clk]
|
|
110
|
+
[e3] btn "Forward" 170,52 32x32 {dis} [clk]
|
|
111
|
+
[e7] nav "Main" 120,88 240x972
|
|
112
|
+
[e8] lnk "Home" 132,100 216x40 {sel} [clk]
|
|
113
|
+
[e9] lnk "Search" 132,148 216x40 [clk]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## CLI
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Print the foreground window tree (default)
|
|
120
|
+
python -m cup
|
|
121
|
+
|
|
122
|
+
# Filter by app name
|
|
123
|
+
python -m cup --scope full --app Discord
|
|
124
|
+
|
|
125
|
+
# Save JSON envelope to file
|
|
126
|
+
python -m cup --json-out tree.json
|
|
127
|
+
|
|
128
|
+
# Capture from Chrome via CDP
|
|
129
|
+
python -m cup --platform web --cdp-port 9222
|
|
130
|
+
|
|
131
|
+
# Include diagnostics (timing, role distribution, sizes)
|
|
132
|
+
python -m cup --verbose
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Platform support
|
|
136
|
+
|
|
137
|
+
| Platform | Adapter | Tree Capture | Actions |
|
|
138
|
+
|----------|---------|-------------|---------|
|
|
139
|
+
| Windows | UIA COM (comtypes) | Stable | Stable |
|
|
140
|
+
| macOS | AXUIElement (pyobjc) | Stable | Stable |
|
|
141
|
+
| Linux | AT-SPI2 (PyGObject) | Stable | Stable |
|
|
142
|
+
| Web | Chrome DevTools Protocol | Stable | Stable |
|
|
143
|
+
| Android | | Planned | Planned |
|
|
144
|
+
| iOS | | Planned | Planned |
|
|
145
|
+
|
|
146
|
+
CUP auto-detects your platform. Platform-specific dependencies (comtypes on Windows, pyobjc on macOS) are installed automatically.
|
|
147
|
+
|
|
148
|
+
## Architecture
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
cup/
|
|
152
|
+
├── __init__.py # Public API: snapshot, action, find, ...
|
|
153
|
+
├── __main__.py # CLI entry point
|
|
154
|
+
├── _base.py # Abstract PlatformAdapter interface
|
|
155
|
+
├── _router.py # Platform detection & adapter dispatch
|
|
156
|
+
├── format.py # Envelope builder, compact serializer, tree pruning
|
|
157
|
+
├── search.py # Semantic element search with fuzzy matching
|
|
158
|
+
├── actions/ # Action execution layer
|
|
159
|
+
│ ├── executor.py # ActionExecutor orchestrator
|
|
160
|
+
│ ├── _handler.py # Abstract ActionHandler interface
|
|
161
|
+
│ ├── _keys.py # Key name mapping utilities
|
|
162
|
+
│ ├── _windows.py # Windows UIA actions
|
|
163
|
+
│ ├── _web.py # Chrome CDP actions
|
|
164
|
+
│ ├── _macos.py # macOS actions (Quartz CGEvents + AX)
|
|
165
|
+
│ └── _linux.py # Linux actions (XTest + AT-SPI2)
|
|
166
|
+
├── platforms/ # Platform-specific tree capture
|
|
167
|
+
│ ├── windows.py # Windows UIA adapter
|
|
168
|
+
│ ├── macos.py # macOS AXUIElement adapter
|
|
169
|
+
│ ├── linux.py # Linux AT-SPI2 adapter
|
|
170
|
+
│ └── web.py # Chrome CDP adapter
|
|
171
|
+
└── mcp/ # MCP server integration
|
|
172
|
+
├── __main__.py # python -m cup.mcp entry point
|
|
173
|
+
└── server.py # MCP protocol server
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Adding a new platform means implementing `PlatformAdapter` — see [cup/_base.py](cup/_base.py) for the interface.
|
|
177
|
+
|
|
178
|
+
## MCP Server
|
|
179
|
+
|
|
180
|
+
CUP ships an MCP server for integration with AI agents (Claude, Copilot, etc.).
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Run directly
|
|
184
|
+
cup-mcp
|
|
185
|
+
|
|
186
|
+
# Or via Python
|
|
187
|
+
python -m cup.mcp
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Add to your MCP client config (e.g., `.mcp.json` for Claude Code):
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"mcpServers": {
|
|
195
|
+
"cup": {
|
|
196
|
+
"command": "cup-mcp",
|
|
197
|
+
"args": []
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Tools:** `snapshot`, `snapshot_app`, `overview`, `snapshot_desktop`, `find`, `action`, `open_app`, `screenshot`
|
|
204
|
+
|
|
205
|
+
## Contributing
|
|
206
|
+
|
|
207
|
+
CUP is in early development (v0.1.0). Contributions welcome — especially:
|
|
208
|
+
|
|
209
|
+
- Android adapter (`cup/platforms/android.py`)
|
|
210
|
+
- iOS adapter (`cup/platforms/ios.py`)
|
|
211
|
+
- Tests — especially cross-platform integration tests
|
|
212
|
+
- Documentation and examples
|
|
213
|
+
|
|
214
|
+
For protocol or schema changes, please contribute to [computeruseprotocol](https://github.com/computeruseprotocol/computeruseprotocol).
|
|
215
|
+
|
|
216
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions and guidelines.
|
|
217
|
+
|
|
218
|
+
## Documentation
|
|
219
|
+
|
|
220
|
+
- **[API Reference](docs/api-reference.md)** — Session API, actions, envelope format, MCP server
|
|
221
|
+
- **[Protocol Specification](https://github.com/computeruseprotocol/computeruseprotocol)** — Schema, roles, states, actions, compact format
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
cup/__init__.py,sha256=Su-DHp4rCCBImwa9f2yWO54D0z_dOKlkYOXkzjOgnfM,18744
|
|
2
|
+
cup/__main__.py,sha256=RdBUOjYb2CwzPAMOBbh3u0ycjDTl6y9DdXEkBTKBN00,7823
|
|
3
|
+
cup/_base.py,sha256=c7rdQ7S9sCG82N2-jaRk_VIYulFynRMV_YvwnxHiHB4,3919
|
|
4
|
+
cup/_router.py,sha256=EAIIDIM93gltf1vHDC9fQ7D6oazRV1rIYUUXdzvfPCQ,1786
|
|
5
|
+
cup/format.py,sha256=poBK6MMnqD6NpoedZX3PqqDi050PysCLSSHoU85db28,22058
|
|
6
|
+
cup/search.py,sha256=Nvshkxkcbkodv21liULmQ5BWjq6WP3rsMnTM01AzCxU,17737
|
|
7
|
+
cup/actions/__init__.py,sha256=-BD-tzvyQSeBLAtdq2blz-VHLAL9hXzgzi9TZML1fZ0,238
|
|
8
|
+
cup/actions/_handler.py,sha256=roNDyZ6PZpomC-hRjh-RDHKKPNYYY8TDIn_hz1IwGeo,1744
|
|
9
|
+
cup/actions/_keys.py,sha256=huWYIsZ0nTY4mhg6VicXZqqmT6OwW6P0T74R1JibtiQ,1467
|
|
10
|
+
cup/actions/_linux.py,sha256=3nUBP9fwHVtY4InhHbSyWoDNrXi4-01YMZGo7JoErIs,34345
|
|
11
|
+
cup/actions/_macos.py,sha256=9i9681aQsC3KMUS8Yu02CK2e3A6PMH52ZKnGxCUW3zI,35605
|
|
12
|
+
cup/actions/_web.py,sha256=p-9ggmXdUlcasMUlmZAc0bXDZStTtQWFkR719UUfNng,18127
|
|
13
|
+
cup/actions/_windows.py,sha256=1YWoWVKG-OZmHJk__X5bl8bMEtoGy_oxSD3vUDSdOCU,33119
|
|
14
|
+
cup/actions/executor.py,sha256=dE70ADgGSOjxWSuviJ-TVbwpNTGHOj1AfZM4Zox1MlQ,5072
|
|
15
|
+
cup/mcp/__init__.py,sha256=yypL_prk481sh0iwLQyknDZDtxidDMiz4YzY5kQTDkg,81
|
|
16
|
+
cup/mcp/__main__.py,sha256=Kpv5pKBPIGGvnL1JCfMewrJlRWFM-K3NEAEAwv1GpJo,165
|
|
17
|
+
cup/mcp/server.py,sha256=HTzvAc4oCjq2lX-SnNKc8teEaKWzFDKBOk9pMNTovGU,14184
|
|
18
|
+
cup/platforms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
cup/platforms/linux.py,sha256=Hn2daC1ElO52Ry1utiE3FLQfvhG2L-rZys7lskZOnPE,34483
|
|
20
|
+
cup/platforms/macos.py,sha256=uWVeoOdE52AtSPXTFRAR8dG9gD3f_zU-3kVHlb96Cz4,33959
|
|
21
|
+
cup/platforms/web.py,sha256=B5MTew-c0Mpm6ADIJT0diCX-WuXWvpqL8FM_qMQedqg,28459
|
|
22
|
+
cup/platforms/windows.py,sha256=5dnkDkrTPzP9kTbFh4lI-Xc_ffaaNbiUrCynYcai-TU,30584
|
|
23
|
+
computeruseprotocol-0.1.0.dist-info/METADATA,sha256=21bOFa4m6eVbGDlph0GQd9KQFDYopBVFCGm1e2eLYJs,8139
|
|
24
|
+
computeruseprotocol-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
25
|
+
computeruseprotocol-0.1.0.dist-info/entry_points.txt,sha256=1EqVMxnleaiwEqZOXDOK3aTlE7NLryDoZynVL3hs4q8,74
|
|
26
|
+
computeruseprotocol-0.1.0.dist-info/licenses/LICENSE,sha256=IBBlg1YoktpxlPHFtZflf91aHz9YLc92KbEyK3pTLeY,1073
|
|
27
|
+
computeruseprotocol-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CUP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|