v16.ai 0.1.2 → 0.2.1
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.
- package/README.md +58 -36
- package/dist/desktop/control.py +391 -0
- package/dist/index.js +198 -5
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
- package/requirements.txt +4 -0
- package/src/desktop/control.py +391 -0
package/README.md
CHANGED
|
@@ -2,46 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
> AI that actually does things
|
|
4
4
|
|
|
5
|
-
V16 connects your local machine to a powerful AI agent that can
|
|
5
|
+
V16 connects your local machine to a powerful AI agent that can control your entire computer - mouse, keyboard, screen capture, browser automation, code execution, and more.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
```bash
|
|
10
|
-
curl -fsSL https://v16.ai/install | sh
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or via npm:
|
|
14
|
-
|
|
15
9
|
```bash
|
|
16
10
|
npm install -g v16.ai
|
|
17
11
|
```
|
|
18
12
|
|
|
13
|
+
This will also install Python dependencies for desktop control.
|
|
14
|
+
|
|
19
15
|
## Quick Start
|
|
20
16
|
|
|
21
17
|
1. **Sign up** at [v16.ai](https://v16.ai)
|
|
22
18
|
|
|
23
19
|
2. **Get your token** from [v16.ai/settings](https://v16.ai/settings)
|
|
24
|
-
- Click "Show token" to reveal your token
|
|
25
|
-
- Click the copy button to copy the full connect command
|
|
26
20
|
|
|
27
|
-
3. **Connect your machine
|
|
21
|
+
3. **Connect your machine**:
|
|
28
22
|
```bash
|
|
29
23
|
v16 connect --token YOUR_TOKEN
|
|
30
24
|
```
|
|
31
25
|
|
|
32
|
-
Or set as environment variable:
|
|
33
|
-
```bash
|
|
34
|
-
export V16_TOKEN=YOUR_TOKEN
|
|
35
|
-
v16 connect
|
|
36
|
-
```
|
|
37
|
-
|
|
38
26
|
4. **Start using V16** - Go to the [dashboard](https://v16.ai/dashboard) and tell the agent what to do
|
|
39
27
|
|
|
40
|
-
> **Note:** A valid token is required to connect. Get yours at [v16.ai/settings](https://v16.ai/settings)
|
|
41
|
-
|
|
42
28
|
## What V16 Can Do
|
|
43
29
|
|
|
44
|
-
|
|
30
|
+
### Desktop Control (NEW)
|
|
31
|
+
Full control over your computer:
|
|
32
|
+
- **Screen Capture** - Take screenshots of your entire screen
|
|
33
|
+
- **Mouse Control** - Move, click, drag, scroll anywhere
|
|
34
|
+
- **Keyboard Control** - Type text, press keys, hotkeys (Cmd+C, etc.)
|
|
35
|
+
- **Window Management** - List windows, focus apps, get window bounds
|
|
36
|
+
- **Clipboard** - Read and write clipboard content
|
|
45
37
|
|
|
46
38
|
### Execute Code
|
|
47
39
|
- Run shell commands and scripts
|
|
@@ -53,32 +45,67 @@ Once connected, the V16 agent can:
|
|
|
53
45
|
- Read and write files
|
|
54
46
|
- Create and organize directories
|
|
55
47
|
- Search and modify content
|
|
56
|
-
- Handle any file format
|
|
57
48
|
|
|
58
49
|
### Automate Browsers
|
|
59
50
|
- Open websites and navigate
|
|
60
51
|
- Fill forms and click buttons
|
|
61
52
|
- Take screenshots
|
|
62
53
|
- Scrape data
|
|
63
|
-
- Run JavaScript
|
|
64
54
|
|
|
65
|
-
###
|
|
66
|
-
- "
|
|
67
|
-
- "
|
|
68
|
-
- "
|
|
69
|
-
- "
|
|
55
|
+
### Example Tasks
|
|
56
|
+
- "Open Chrome and go to twitter.com"
|
|
57
|
+
- "Take a screenshot and describe what you see"
|
|
58
|
+
- "Click the login button and enter my credentials"
|
|
59
|
+
- "Open VS Code and create a new file"
|
|
60
|
+
- "Build me a REST API and test it"
|
|
70
61
|
|
|
71
62
|
## Commands
|
|
72
63
|
|
|
73
64
|
```bash
|
|
74
65
|
v16 connect # Connect to V16
|
|
75
66
|
v16 connect --token XXX # Connect with specific token
|
|
76
|
-
v16
|
|
77
|
-
v16
|
|
78
|
-
v16 logout # Disconnect and clear credentials
|
|
67
|
+
v16 test # Test all capabilities (CLI, browser, desktop)
|
|
68
|
+
v16 login # Get token instructions
|
|
79
69
|
v16 --help # Show all commands
|
|
80
70
|
```
|
|
81
71
|
|
|
72
|
+
## Desktop Control Capabilities
|
|
73
|
+
|
|
74
|
+
| Command | Description |
|
|
75
|
+
|---------|-------------|
|
|
76
|
+
| `screenshot` | Capture full screen |
|
|
77
|
+
| `mouse-move` | Move cursor to x,y coordinates |
|
|
78
|
+
| `mouse-click` | Click at position |
|
|
79
|
+
| `mouse-double-click` | Double click |
|
|
80
|
+
| `mouse-right-click` | Right click |
|
|
81
|
+
| `mouse-drag` | Drag from point A to B |
|
|
82
|
+
| `mouse-scroll` | Scroll up/down |
|
|
83
|
+
| `keyboard-type` | Type text |
|
|
84
|
+
| `keyboard-press` | Press single key (Enter, Escape, etc.) |
|
|
85
|
+
| `keyboard-hotkey` | Key combo (Cmd+C, Ctrl+V, etc.) |
|
|
86
|
+
| `clipboard-read` | Read clipboard content |
|
|
87
|
+
| `clipboard-write` | Write to clipboard |
|
|
88
|
+
| `window-list` | List all open windows |
|
|
89
|
+
| `window-focus` | Focus/activate an app |
|
|
90
|
+
|
|
91
|
+
## Requirements
|
|
92
|
+
|
|
93
|
+
- Node.js 18+
|
|
94
|
+
- Python 3.8+ with pip
|
|
95
|
+
- macOS, Windows, or Linux
|
|
96
|
+
|
|
97
|
+
### Python Dependencies (auto-installed)
|
|
98
|
+
- pyautogui - Mouse and keyboard control
|
|
99
|
+
- mss - Fast screen capture
|
|
100
|
+
- pyperclip - Clipboard access
|
|
101
|
+
- Pillow - Image processing
|
|
102
|
+
|
|
103
|
+
### macOS Permissions
|
|
104
|
+
On macOS, you need to grant accessibility permissions:
|
|
105
|
+
1. Go to System Preferences → Security & Privacy → Privacy
|
|
106
|
+
2. Select "Accessibility" from the left sidebar
|
|
107
|
+
3. Add Terminal (or your terminal app) to the list
|
|
108
|
+
|
|
82
109
|
## Environment Variables
|
|
83
110
|
|
|
84
111
|
| Variable | Description |
|
|
@@ -86,19 +113,14 @@ v16 --help # Show all commands
|
|
|
86
113
|
| `V16_TOKEN` | Your authentication token |
|
|
87
114
|
| `V16_SERVER` | Custom server URL (default: `https://api.v16.ai`) |
|
|
88
115
|
|
|
89
|
-
## Requirements
|
|
90
|
-
|
|
91
|
-
- Node.js 18+
|
|
92
|
-
- Chrome/Chromium for browser automation (auto-installed via Puppeteer)
|
|
93
|
-
|
|
94
116
|
## Security
|
|
95
117
|
|
|
96
118
|
- All communication is encrypted (HTTPS/WSS)
|
|
97
119
|
- Only authenticated commands from your V16 account are executed
|
|
98
|
-
- You control what the agent can access
|
|
120
|
+
- You control what the agent can access
|
|
99
121
|
- Disconnect anytime with `v16 logout`
|
|
100
122
|
|
|
101
|
-
**Note:** The agent
|
|
123
|
+
**Note:** The agent has full control over your computer. Only connect machines you trust.
|
|
102
124
|
|
|
103
125
|
## Links
|
|
104
126
|
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
V16 Desktop Control - Full computer control via Python
|
|
4
|
+
Handles: screen capture, mouse, keyboard, windows, clipboard
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import json
|
|
9
|
+
import base64
|
|
10
|
+
import io
|
|
11
|
+
import time
|
|
12
|
+
import subprocess
|
|
13
|
+
import platform
|
|
14
|
+
|
|
15
|
+
# Lazy imports to handle missing dependencies gracefully
|
|
16
|
+
pyautogui = None
|
|
17
|
+
mss = None
|
|
18
|
+
pyperclip = None
|
|
19
|
+
|
|
20
|
+
def init_deps():
|
|
21
|
+
"""Initialize dependencies"""
|
|
22
|
+
global pyautogui, mss, pyperclip
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
import pyautogui as _pyautogui
|
|
26
|
+
pyautogui = _pyautogui
|
|
27
|
+
pyautogui.FAILSAFE = False
|
|
28
|
+
pyautogui.PAUSE = 0.1
|
|
29
|
+
except ImportError:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
import mss as _mss
|
|
34
|
+
mss = _mss
|
|
35
|
+
except ImportError:
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
import pyperclip as _pyperclip
|
|
40
|
+
pyperclip = _pyperclip
|
|
41
|
+
except ImportError:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
init_deps()
|
|
45
|
+
|
|
46
|
+
# ============ Screen Capture ============
|
|
47
|
+
|
|
48
|
+
def screenshot(region=None):
|
|
49
|
+
"""Capture screenshot of full screen or region"""
|
|
50
|
+
try:
|
|
51
|
+
if mss:
|
|
52
|
+
with mss.mss() as sct:
|
|
53
|
+
if region:
|
|
54
|
+
monitor = {"left": region["x"], "top": region["y"],
|
|
55
|
+
"width": region["width"], "height": region["height"]}
|
|
56
|
+
else:
|
|
57
|
+
monitor = sct.monitors[0]
|
|
58
|
+
|
|
59
|
+
img = sct.grab(monitor)
|
|
60
|
+
|
|
61
|
+
from PIL import Image
|
|
62
|
+
pil_img = Image.frombytes("RGB", img.size, img.bgra, "raw", "BGRX")
|
|
63
|
+
buffer = io.BytesIO()
|
|
64
|
+
pil_img.save(buffer, format="PNG", optimize=True)
|
|
65
|
+
b64 = base64.b64encode(buffer.getvalue()).decode()
|
|
66
|
+
|
|
67
|
+
return {"success": True, "image": f"data:image/png;base64,{b64}",
|
|
68
|
+
"width": img.width, "height": img.height}
|
|
69
|
+
|
|
70
|
+
elif pyautogui:
|
|
71
|
+
img = pyautogui.screenshot(region=region)
|
|
72
|
+
buffer = io.BytesIO()
|
|
73
|
+
img.save(buffer, format="PNG")
|
|
74
|
+
b64 = base64.b64encode(buffer.getvalue()).decode()
|
|
75
|
+
return {"success": True, "image": f"data:image/png;base64,{b64}",
|
|
76
|
+
"width": img.width, "height": img.height}
|
|
77
|
+
|
|
78
|
+
return {"success": False, "error": "No screen capture library available"}
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
return {"success": False, "error": str(e)}
|
|
82
|
+
|
|
83
|
+
def get_screen_size():
|
|
84
|
+
"""Get screen dimensions"""
|
|
85
|
+
try:
|
|
86
|
+
if pyautogui:
|
|
87
|
+
size = pyautogui.size()
|
|
88
|
+
return {"success": True, "width": size.width, "height": size.height}
|
|
89
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
90
|
+
except Exception as e:
|
|
91
|
+
return {"success": False, "error": str(e)}
|
|
92
|
+
|
|
93
|
+
def get_mouse_position():
|
|
94
|
+
"""Get current mouse position"""
|
|
95
|
+
try:
|
|
96
|
+
if pyautogui:
|
|
97
|
+
pos = pyautogui.position()
|
|
98
|
+
return {"success": True, "x": pos.x, "y": pos.y}
|
|
99
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
100
|
+
except Exception as e:
|
|
101
|
+
return {"success": False, "error": str(e)}
|
|
102
|
+
|
|
103
|
+
# ============ Mouse Control ============
|
|
104
|
+
|
|
105
|
+
def mouse_move(x, y, duration=0.2):
|
|
106
|
+
"""Move mouse to coordinates"""
|
|
107
|
+
try:
|
|
108
|
+
if pyautogui:
|
|
109
|
+
pyautogui.moveTo(x, y, duration=duration)
|
|
110
|
+
return {"success": True, "x": x, "y": y}
|
|
111
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
112
|
+
except Exception as e:
|
|
113
|
+
return {"success": False, "error": str(e)}
|
|
114
|
+
|
|
115
|
+
def mouse_click(x=None, y=None, button="left", clicks=1):
|
|
116
|
+
"""Click at position"""
|
|
117
|
+
try:
|
|
118
|
+
if pyautogui:
|
|
119
|
+
if x is not None and y is not None:
|
|
120
|
+
pyautogui.click(x, y, clicks=clicks, button=button)
|
|
121
|
+
else:
|
|
122
|
+
pyautogui.click(clicks=clicks, button=button)
|
|
123
|
+
return {"success": True}
|
|
124
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
125
|
+
except Exception as e:
|
|
126
|
+
return {"success": False, "error": str(e)}
|
|
127
|
+
|
|
128
|
+
def mouse_double_click(x=None, y=None):
|
|
129
|
+
"""Double click at position"""
|
|
130
|
+
return mouse_click(x, y, clicks=2)
|
|
131
|
+
|
|
132
|
+
def mouse_right_click(x=None, y=None):
|
|
133
|
+
"""Right click at position"""
|
|
134
|
+
return mouse_click(x, y, button="right")
|
|
135
|
+
|
|
136
|
+
def mouse_drag(start_x, start_y, end_x, end_y, duration=0.5):
|
|
137
|
+
"""Drag from start to end position"""
|
|
138
|
+
try:
|
|
139
|
+
if pyautogui:
|
|
140
|
+
pyautogui.moveTo(start_x, start_y)
|
|
141
|
+
pyautogui.drag(end_x - start_x, end_y - start_y, duration=duration)
|
|
142
|
+
return {"success": True}
|
|
143
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
144
|
+
except Exception as e:
|
|
145
|
+
return {"success": False, "error": str(e)}
|
|
146
|
+
|
|
147
|
+
def mouse_scroll(amount, x=None, y=None):
|
|
148
|
+
"""Scroll at position (positive=up, negative=down)"""
|
|
149
|
+
try:
|
|
150
|
+
if pyautogui:
|
|
151
|
+
if x is not None and y is not None:
|
|
152
|
+
pyautogui.moveTo(x, y)
|
|
153
|
+
pyautogui.scroll(amount)
|
|
154
|
+
return {"success": True}
|
|
155
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
156
|
+
except Exception as e:
|
|
157
|
+
return {"success": False, "error": str(e)}
|
|
158
|
+
|
|
159
|
+
# ============ Keyboard Control ============
|
|
160
|
+
|
|
161
|
+
def keyboard_type(text, interval=0.02):
|
|
162
|
+
"""Type text"""
|
|
163
|
+
try:
|
|
164
|
+
if pyautogui:
|
|
165
|
+
# Use write for unicode support
|
|
166
|
+
pyautogui.write(text, interval=interval)
|
|
167
|
+
return {"success": True}
|
|
168
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
169
|
+
except Exception as e:
|
|
170
|
+
return {"success": False, "error": str(e)}
|
|
171
|
+
|
|
172
|
+
def keyboard_press(key):
|
|
173
|
+
"""Press a single key"""
|
|
174
|
+
try:
|
|
175
|
+
if pyautogui:
|
|
176
|
+
pyautogui.press(key)
|
|
177
|
+
return {"success": True}
|
|
178
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
179
|
+
except Exception as e:
|
|
180
|
+
return {"success": False, "error": str(e)}
|
|
181
|
+
|
|
182
|
+
def keyboard_hotkey(*keys):
|
|
183
|
+
"""Press key combination (e.g., 'command', 'c' for Cmd+C)"""
|
|
184
|
+
try:
|
|
185
|
+
if pyautogui:
|
|
186
|
+
pyautogui.hotkey(*keys)
|
|
187
|
+
return {"success": True}
|
|
188
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
189
|
+
except Exception as e:
|
|
190
|
+
return {"success": False, "error": str(e)}
|
|
191
|
+
|
|
192
|
+
def keyboard_key_down(key):
|
|
193
|
+
"""Hold key down"""
|
|
194
|
+
try:
|
|
195
|
+
if pyautogui:
|
|
196
|
+
pyautogui.keyDown(key)
|
|
197
|
+
return {"success": True}
|
|
198
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
199
|
+
except Exception as e:
|
|
200
|
+
return {"success": False, "error": str(e)}
|
|
201
|
+
|
|
202
|
+
def keyboard_key_up(key):
|
|
203
|
+
"""Release key"""
|
|
204
|
+
try:
|
|
205
|
+
if pyautogui:
|
|
206
|
+
pyautogui.keyUp(key)
|
|
207
|
+
return {"success": True}
|
|
208
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
209
|
+
except Exception as e:
|
|
210
|
+
return {"success": False, "error": str(e)}
|
|
211
|
+
|
|
212
|
+
# ============ Clipboard ============
|
|
213
|
+
|
|
214
|
+
def clipboard_read():
|
|
215
|
+
"""Read clipboard content"""
|
|
216
|
+
try:
|
|
217
|
+
if pyperclip:
|
|
218
|
+
content = pyperclip.paste()
|
|
219
|
+
return {"success": True, "content": content}
|
|
220
|
+
|
|
221
|
+
if platform.system() == "Darwin":
|
|
222
|
+
result = subprocess.run(["pbpaste"], capture_output=True, text=True)
|
|
223
|
+
return {"success": True, "content": result.stdout}
|
|
224
|
+
|
|
225
|
+
return {"success": False, "error": "No clipboard library available"}
|
|
226
|
+
except Exception as e:
|
|
227
|
+
return {"success": False, "error": str(e)}
|
|
228
|
+
|
|
229
|
+
def clipboard_write(content):
|
|
230
|
+
"""Write to clipboard"""
|
|
231
|
+
try:
|
|
232
|
+
if pyperclip:
|
|
233
|
+
pyperclip.copy(content)
|
|
234
|
+
return {"success": True}
|
|
235
|
+
|
|
236
|
+
if platform.system() == "Darwin":
|
|
237
|
+
subprocess.run(["pbcopy"], input=content.encode(), check=True)
|
|
238
|
+
return {"success": True}
|
|
239
|
+
|
|
240
|
+
return {"success": False, "error": "No clipboard library available"}
|
|
241
|
+
except Exception as e:
|
|
242
|
+
return {"success": False, "error": str(e)}
|
|
243
|
+
|
|
244
|
+
# ============ Window Management ============
|
|
245
|
+
|
|
246
|
+
def window_list():
|
|
247
|
+
"""List all open windows"""
|
|
248
|
+
try:
|
|
249
|
+
if platform.system() == "Darwin":
|
|
250
|
+
script = '''
|
|
251
|
+
tell application "System Events"
|
|
252
|
+
set windowList to {}
|
|
253
|
+
repeat with proc in (every process whose visible is true)
|
|
254
|
+
set procName to name of proc
|
|
255
|
+
repeat with win in (every window of proc)
|
|
256
|
+
set winName to name of win
|
|
257
|
+
set end of windowList to procName & ": " & winName
|
|
258
|
+
end repeat
|
|
259
|
+
end repeat
|
|
260
|
+
return windowList
|
|
261
|
+
end tell
|
|
262
|
+
'''
|
|
263
|
+
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
|
264
|
+
windows = result.stdout.strip().split(", ")
|
|
265
|
+
return {"success": True, "windows": windows}
|
|
266
|
+
|
|
267
|
+
return {"success": False, "error": "Window listing only supported on macOS"}
|
|
268
|
+
except Exception as e:
|
|
269
|
+
return {"success": False, "error": str(e)}
|
|
270
|
+
|
|
271
|
+
def window_focus(app_name):
|
|
272
|
+
"""Focus/activate an application window"""
|
|
273
|
+
try:
|
|
274
|
+
if platform.system() == "Darwin":
|
|
275
|
+
script = f'tell application "{app_name}" to activate'
|
|
276
|
+
subprocess.run(["osascript", "-e", script], check=True)
|
|
277
|
+
return {"success": True}
|
|
278
|
+
|
|
279
|
+
return {"success": False, "error": "Window focus only supported on macOS"}
|
|
280
|
+
except Exception as e:
|
|
281
|
+
return {"success": False, "error": str(e)}
|
|
282
|
+
|
|
283
|
+
def window_bounds(app_name):
|
|
284
|
+
"""Get window position and size"""
|
|
285
|
+
try:
|
|
286
|
+
if platform.system() == "Darwin":
|
|
287
|
+
script = f'''
|
|
288
|
+
tell application "System Events"
|
|
289
|
+
tell process "{app_name}"
|
|
290
|
+
set frontWindow to front window
|
|
291
|
+
set pos to position of frontWindow
|
|
292
|
+
set sz to size of frontWindow
|
|
293
|
+
return (item 1 of pos) & "," & (item 2 of pos) & "," & (item 1 of sz) & "," & (item 2 of sz)
|
|
294
|
+
end tell
|
|
295
|
+
end tell
|
|
296
|
+
'''
|
|
297
|
+
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
|
298
|
+
parts = result.stdout.strip().split(",")
|
|
299
|
+
return {"success": True, "x": int(parts[0]), "y": int(parts[1]),
|
|
300
|
+
"width": int(parts[2]), "height": int(parts[3])}
|
|
301
|
+
|
|
302
|
+
return {"success": False, "error": "Window bounds only supported on macOS"}
|
|
303
|
+
except Exception as e:
|
|
304
|
+
return {"success": False, "error": str(e)}
|
|
305
|
+
|
|
306
|
+
# ============ Utilities ============
|
|
307
|
+
|
|
308
|
+
def wait(seconds):
|
|
309
|
+
"""Wait/sleep"""
|
|
310
|
+
time.sleep(seconds)
|
|
311
|
+
return {"success": True}
|
|
312
|
+
|
|
313
|
+
def locate_on_screen(image_path, confidence=0.9):
|
|
314
|
+
"""Find image on screen and return its position"""
|
|
315
|
+
try:
|
|
316
|
+
if pyautogui:
|
|
317
|
+
try:
|
|
318
|
+
location = pyautogui.locateOnScreen(image_path, confidence=confidence)
|
|
319
|
+
except pyautogui.ImageNotFoundException:
|
|
320
|
+
return {"success": False, "error": "Image not found on screen"}
|
|
321
|
+
|
|
322
|
+
if location:
|
|
323
|
+
center = pyautogui.center(location)
|
|
324
|
+
return {"success": True, "x": center.x, "y": center.y,
|
|
325
|
+
"left": location.left, "top": location.top,
|
|
326
|
+
"width": location.width, "height": location.height}
|
|
327
|
+
return {"success": False, "error": "Image not found on screen"}
|
|
328
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
329
|
+
except Exception as e:
|
|
330
|
+
return {"success": False, "error": str(e)}
|
|
331
|
+
|
|
332
|
+
# ============ Main Handler ============
|
|
333
|
+
|
|
334
|
+
COMMANDS = {
|
|
335
|
+
"screenshot": screenshot,
|
|
336
|
+
"screen_size": get_screen_size,
|
|
337
|
+
"mouse_position": get_mouse_position,
|
|
338
|
+
"mouse_move": mouse_move,
|
|
339
|
+
"mouse_click": mouse_click,
|
|
340
|
+
"mouse_double_click": mouse_double_click,
|
|
341
|
+
"mouse_right_click": mouse_right_click,
|
|
342
|
+
"mouse_drag": mouse_drag,
|
|
343
|
+
"mouse_scroll": mouse_scroll,
|
|
344
|
+
"keyboard_type": keyboard_type,
|
|
345
|
+
"keyboard_press": keyboard_press,
|
|
346
|
+
"keyboard_hotkey": keyboard_hotkey,
|
|
347
|
+
"keyboard_key_down": keyboard_key_down,
|
|
348
|
+
"keyboard_key_up": keyboard_key_up,
|
|
349
|
+
"clipboard_read": clipboard_read,
|
|
350
|
+
"clipboard_write": clipboard_write,
|
|
351
|
+
"window_list": window_list,
|
|
352
|
+
"window_focus": window_focus,
|
|
353
|
+
"window_bounds": window_bounds,
|
|
354
|
+
"wait": wait,
|
|
355
|
+
"locate_on_screen": locate_on_screen,
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
def handle_command(cmd_data):
|
|
359
|
+
"""Handle incoming command"""
|
|
360
|
+
cmd_type = cmd_data.get("type")
|
|
361
|
+
payload = cmd_data.get("payload", {})
|
|
362
|
+
|
|
363
|
+
if cmd_type not in COMMANDS:
|
|
364
|
+
return {"success": False, "error": f"Unknown command: {cmd_type}"}
|
|
365
|
+
|
|
366
|
+
try:
|
|
367
|
+
func = COMMANDS[cmd_type]
|
|
368
|
+
if payload:
|
|
369
|
+
result = func(**payload)
|
|
370
|
+
else:
|
|
371
|
+
result = func()
|
|
372
|
+
return result
|
|
373
|
+
except TypeError as e:
|
|
374
|
+
return {"success": False, "error": f"Invalid arguments: {str(e)}"}
|
|
375
|
+
except Exception as e:
|
|
376
|
+
return {"success": False, "error": str(e)}
|
|
377
|
+
|
|
378
|
+
def main():
|
|
379
|
+
"""Main entry - reads JSON from stdin, writes result to stdout"""
|
|
380
|
+
try:
|
|
381
|
+
input_data = sys.stdin.read()
|
|
382
|
+
cmd_data = json.loads(input_data)
|
|
383
|
+
result = handle_command(cmd_data)
|
|
384
|
+
print(json.dumps(result))
|
|
385
|
+
except json.JSONDecodeError as e:
|
|
386
|
+
print(json.dumps({"success": False, "error": f"Invalid JSON: {str(e)}"}))
|
|
387
|
+
except Exception as e:
|
|
388
|
+
print(json.dumps({"success": False, "error": str(e)}))
|
|
389
|
+
|
|
390
|
+
if __name__ == "__main__":
|
|
391
|
+
main()
|
package/dist/index.js
CHANGED
|
@@ -48,7 +48,8 @@ const ora_1 = __importDefault(require("ora"));
|
|
|
48
48
|
const puppeteer_1 = __importDefault(require("puppeteer"));
|
|
49
49
|
// Configuration
|
|
50
50
|
const DEFAULT_SERVER = process.env.V16_SERVER || 'https://api.v16.ai';
|
|
51
|
-
const VERSION = '0.
|
|
51
|
+
const VERSION = '0.2.0';
|
|
52
|
+
const PYTHON_SCRIPT = path.join(__dirname, 'desktop', 'control.py');
|
|
52
53
|
// State
|
|
53
54
|
let socket = null;
|
|
54
55
|
let browser = null;
|
|
@@ -80,6 +81,59 @@ async function executeCommand(command, cwd, timeout = 60000) {
|
|
|
80
81
|
});
|
|
81
82
|
});
|
|
82
83
|
}
|
|
84
|
+
// Execute command in background (non-blocking) - for servers and persistent processes
|
|
85
|
+
function executeCommandBackground(commandId, command, cwd) {
|
|
86
|
+
const workingDir = cwd || currentCwd;
|
|
87
|
+
const { spawn } = require('child_process');
|
|
88
|
+
try {
|
|
89
|
+
// Use spawn with detached and shell to run in background
|
|
90
|
+
const child = spawn(command, [], {
|
|
91
|
+
cwd: workingDir,
|
|
92
|
+
shell: true,
|
|
93
|
+
detached: true,
|
|
94
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
95
|
+
env: { ...process.env, FORCE_COLOR: '1' },
|
|
96
|
+
});
|
|
97
|
+
// Store the process reference
|
|
98
|
+
activeProcesses.set(commandId, child);
|
|
99
|
+
// Capture some initial output for logging
|
|
100
|
+
let initialOutput = '';
|
|
101
|
+
child.stdout?.on('data', (data) => {
|
|
102
|
+
const text = data.toString();
|
|
103
|
+
if (initialOutput.length < 500) {
|
|
104
|
+
initialOutput += text;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
child.stderr?.on('data', (data) => {
|
|
108
|
+
const text = data.toString();
|
|
109
|
+
if (initialOutput.length < 500) {
|
|
110
|
+
initialOutput += text;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
child.on('error', (error) => {
|
|
114
|
+
log.error(`Background process error: ${error.message}`);
|
|
115
|
+
activeProcesses.delete(commandId);
|
|
116
|
+
});
|
|
117
|
+
child.on('exit', (code) => {
|
|
118
|
+
log.info(`Background process ${commandId} exited with code ${code}`);
|
|
119
|
+
activeProcesses.delete(commandId);
|
|
120
|
+
});
|
|
121
|
+
// Don't wait for the process - unref it so Node can exit if needed
|
|
122
|
+
child.unref();
|
|
123
|
+
log.success(`Started background process: ${command} (PID: ${child.pid})`);
|
|
124
|
+
return {
|
|
125
|
+
success: true,
|
|
126
|
+
pid: child.pid,
|
|
127
|
+
message: `Process started in background with PID ${child.pid}`,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
message: `Failed to start background process: ${error.message}`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
83
137
|
// File operations
|
|
84
138
|
function readFile(filePath) {
|
|
85
139
|
try {
|
|
@@ -127,6 +181,58 @@ function listFiles(dirPath = '.', showHidden = false) {
|
|
|
127
181
|
return { success: false, error: error.message };
|
|
128
182
|
}
|
|
129
183
|
}
|
|
184
|
+
// Desktop control via Python
|
|
185
|
+
async function executeDesktopCommand(type, payload = {}) {
|
|
186
|
+
return new Promise((resolve) => {
|
|
187
|
+
try {
|
|
188
|
+
const pythonScript = fs.existsSync(PYTHON_SCRIPT)
|
|
189
|
+
? PYTHON_SCRIPT
|
|
190
|
+
: path.join(__dirname, '..', 'src', 'desktop', 'control.py');
|
|
191
|
+
const input = JSON.stringify({ type, payload });
|
|
192
|
+
const child = (0, child_process_1.spawn)('python3', [pythonScript], {
|
|
193
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
194
|
+
});
|
|
195
|
+
let stdout = '';
|
|
196
|
+
let stderr = '';
|
|
197
|
+
child.stdout.on('data', (data) => {
|
|
198
|
+
stdout += data.toString();
|
|
199
|
+
});
|
|
200
|
+
child.stderr.on('data', (data) => {
|
|
201
|
+
stderr += data.toString();
|
|
202
|
+
});
|
|
203
|
+
child.on('close', (code) => {
|
|
204
|
+
try {
|
|
205
|
+
const result = JSON.parse(stdout);
|
|
206
|
+
resolve(result);
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
resolve({
|
|
210
|
+
success: false,
|
|
211
|
+
error: stderr || `Failed to parse response: ${stdout}`
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
child.on('error', (error) => {
|
|
216
|
+
resolve({ success: false, error: error.message });
|
|
217
|
+
});
|
|
218
|
+
child.stdin.write(input);
|
|
219
|
+
child.stdin.end();
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
resolve({ success: false, error: error.message });
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
// Check if desktop control is available
|
|
227
|
+
function checkDesktopAvailable() {
|
|
228
|
+
try {
|
|
229
|
+
(0, child_process_1.execSync)('python3 -c "import pyautogui"', { stdio: 'ignore' });
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
130
236
|
// Browser automation
|
|
131
237
|
async function initBrowser() {
|
|
132
238
|
if (!browser) {
|
|
@@ -234,14 +340,18 @@ function connectToServer(serverUrl, token) {
|
|
|
234
340
|
socket.on('connect', () => {
|
|
235
341
|
spinner.succeed('Connected to V16');
|
|
236
342
|
// Send ready message with system info
|
|
343
|
+
const desktopAvailable = checkDesktopAvailable();
|
|
237
344
|
socket.emit('ready', {
|
|
238
345
|
platform: os.platform(),
|
|
239
346
|
arch: os.arch(),
|
|
240
347
|
hostname: os.hostname(),
|
|
241
348
|
cwd: currentCwd,
|
|
242
349
|
version: VERSION,
|
|
243
|
-
capabilities: ['cli', 'filesystem', 'browser'],
|
|
350
|
+
capabilities: ['cli', 'filesystem', 'browser', ...(desktopAvailable ? ['desktop'] : [])],
|
|
244
351
|
});
|
|
352
|
+
if (desktopAvailable) {
|
|
353
|
+
log.success('Desktop control enabled');
|
|
354
|
+
}
|
|
245
355
|
log.info(`Platform: ${os.platform()} (${os.arch()})`);
|
|
246
356
|
log.info(`Working directory: ${currentCwd}`);
|
|
247
357
|
log.success('Ready - V16 agent can now use your local machine');
|
|
@@ -264,7 +374,14 @@ function connectToServer(serverUrl, token) {
|
|
|
264
374
|
switch (type) {
|
|
265
375
|
// CLI commands
|
|
266
376
|
case 'execute':
|
|
267
|
-
|
|
377
|
+
if (payload.background) {
|
|
378
|
+
// Run in background - return immediately
|
|
379
|
+
result = executeCommandBackground(id, payload.command, payload.cwd);
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
// Normal execution - wait for completion
|
|
383
|
+
result = await executeCommand(payload.command, payload.cwd, payload.timeout);
|
|
384
|
+
}
|
|
268
385
|
break;
|
|
269
386
|
case 'cd':
|
|
270
387
|
const newPath = path.resolve(currentCwd, payload.path);
|
|
@@ -309,6 +426,58 @@ function connectToServer(serverUrl, token) {
|
|
|
309
426
|
await closeBrowser();
|
|
310
427
|
result = { success: true };
|
|
311
428
|
break;
|
|
429
|
+
// Desktop control commands
|
|
430
|
+
case 'screenshot':
|
|
431
|
+
result = await executeDesktopCommand('screenshot', payload);
|
|
432
|
+
break;
|
|
433
|
+
case 'screen-size':
|
|
434
|
+
result = await executeDesktopCommand('screen_size');
|
|
435
|
+
break;
|
|
436
|
+
case 'mouse-position':
|
|
437
|
+
result = await executeDesktopCommand('mouse_position');
|
|
438
|
+
break;
|
|
439
|
+
case 'mouse-move':
|
|
440
|
+
result = await executeDesktopCommand('mouse_move', payload);
|
|
441
|
+
break;
|
|
442
|
+
case 'mouse-click':
|
|
443
|
+
result = await executeDesktopCommand('mouse_click', payload);
|
|
444
|
+
break;
|
|
445
|
+
case 'mouse-double-click':
|
|
446
|
+
result = await executeDesktopCommand('mouse_double_click', payload);
|
|
447
|
+
break;
|
|
448
|
+
case 'mouse-right-click':
|
|
449
|
+
result = await executeDesktopCommand('mouse_right_click', payload);
|
|
450
|
+
break;
|
|
451
|
+
case 'mouse-drag':
|
|
452
|
+
result = await executeDesktopCommand('mouse_drag', payload);
|
|
453
|
+
break;
|
|
454
|
+
case 'mouse-scroll':
|
|
455
|
+
result = await executeDesktopCommand('mouse_scroll', payload);
|
|
456
|
+
break;
|
|
457
|
+
case 'keyboard-type':
|
|
458
|
+
result = await executeDesktopCommand('keyboard_type', payload);
|
|
459
|
+
break;
|
|
460
|
+
case 'keyboard-press':
|
|
461
|
+
result = await executeDesktopCommand('keyboard_press', payload);
|
|
462
|
+
break;
|
|
463
|
+
case 'keyboard-hotkey':
|
|
464
|
+
result = await executeDesktopCommand('keyboard_hotkey', payload);
|
|
465
|
+
break;
|
|
466
|
+
case 'clipboard-read':
|
|
467
|
+
result = await executeDesktopCommand('clipboard_read');
|
|
468
|
+
break;
|
|
469
|
+
case 'clipboard-write':
|
|
470
|
+
result = await executeDesktopCommand('clipboard_write', payload);
|
|
471
|
+
break;
|
|
472
|
+
case 'window-list':
|
|
473
|
+
result = await executeDesktopCommand('window_list');
|
|
474
|
+
break;
|
|
475
|
+
case 'window-focus':
|
|
476
|
+
result = await executeDesktopCommand('window_focus', payload);
|
|
477
|
+
break;
|
|
478
|
+
case 'window-bounds':
|
|
479
|
+
result = await executeDesktopCommand('window_bounds', payload);
|
|
480
|
+
break;
|
|
312
481
|
// System info
|
|
313
482
|
case 'status':
|
|
314
483
|
result = {
|
|
@@ -320,6 +489,7 @@ function connectToServer(serverUrl, token) {
|
|
|
320
489
|
uptime: os.uptime(),
|
|
321
490
|
memory: { total: os.totalmem(), free: os.freemem() },
|
|
322
491
|
browserActive: !!browser,
|
|
492
|
+
desktopAvailable: checkDesktopAvailable(),
|
|
323
493
|
};
|
|
324
494
|
break;
|
|
325
495
|
default:
|
|
@@ -344,6 +514,7 @@ commander_1.program
|
|
|
344
514
|
.description('Connect your machine to V16')
|
|
345
515
|
.option('-s, --server <url>', 'Server URL', DEFAULT_SERVER)
|
|
346
516
|
.option('-t, --token <token>', 'Authentication token')
|
|
517
|
+
.option('-d, --dev', 'Development mode (no auth required)')
|
|
347
518
|
.action(async (options) => {
|
|
348
519
|
console.log(chalk_1.default.cyan(`
|
|
349
520
|
╭───────────────────────────────────────╮
|
|
@@ -352,12 +523,16 @@ commander_1.program
|
|
|
352
523
|
╰───────────────────────────────────────╯
|
|
353
524
|
`));
|
|
354
525
|
const token = options.token || process.env.V16_TOKEN;
|
|
355
|
-
if (!token) {
|
|
526
|
+
if (!token && !options.dev) {
|
|
356
527
|
log.error('Token required. Use --token or set V16_TOKEN');
|
|
357
528
|
log.info('Get your token at https://v16.ai/settings');
|
|
529
|
+
log.info('Or use --dev for local development without auth');
|
|
358
530
|
process.exit(1);
|
|
359
531
|
}
|
|
360
|
-
|
|
532
|
+
if (options.dev) {
|
|
533
|
+
log.info('Running in development mode (no auth)');
|
|
534
|
+
}
|
|
535
|
+
connectToServer(options.server, token || 'dev-token');
|
|
361
536
|
// Keep process running
|
|
362
537
|
process.on('SIGINT', async () => {
|
|
363
538
|
log.info('Shutting down...');
|
|
@@ -390,6 +565,24 @@ commander_1.program
|
|
|
390
565
|
catch (error) {
|
|
391
566
|
log.warn(`Browser: ${error.message}`);
|
|
392
567
|
}
|
|
568
|
+
// Test desktop control
|
|
569
|
+
log.info('Testing desktop control...');
|
|
570
|
+
if (checkDesktopAvailable()) {
|
|
571
|
+
const screenResult = await executeDesktopCommand('screen_size');
|
|
572
|
+
if (screenResult.success) {
|
|
573
|
+
log.success(`Desktop: Screen size ${screenResult.width}x${screenResult.height}`);
|
|
574
|
+
const screenshotResult = await executeDesktopCommand('screenshot');
|
|
575
|
+
if (screenshotResult.success) {
|
|
576
|
+
log.success(`Desktop: Screenshot captured (${Math.round(screenshotResult.image.length / 1024)}KB)`);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
log.warn(`Desktop: ${screenResult.error}`);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
log.warn('Desktop: Python dependencies not installed. Run: pip install -r requirements.txt');
|
|
585
|
+
}
|
|
393
586
|
console.log(chalk_1.default.green('\nAll tests passed'));
|
|
394
587
|
});
|
|
395
588
|
commander_1.program
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uDAA8C;AAC9C,iDAAmD;AACnD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,yCAAoC;AACpC,kDAA0B;AAC1B,8CAAsB;AACtB,0DAAqD;AAErD,gBAAgB;AAChB,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,oBAAoB,CAAC;AACtE,MAAM,OAAO,GAAG,OAAO,C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CAAC,YAAY,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC;;;WAGhB,eAAK,CAAC,SAAS,CAAC,yBAAyB,CAAC;;UAE3C,eAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC;;;KAGjD,eAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC;KACzC,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC;CAC7B,CAAC,CAAC,CAAC;AACF,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "v16.ai",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "V16 - General AI Agent.
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "V16 - General AI Agent. Full desktop control - mouse, keyboard, screen capture, and more. Let AI control your computer.",
|
|
5
5
|
"author": "V16 <support@v16.ai>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"ai-agent",
|
|
22
22
|
"code-execution",
|
|
23
23
|
"browser-automation",
|
|
24
|
+
"desktop-automation",
|
|
25
|
+
"computer-control",
|
|
26
|
+
"screen-capture",
|
|
27
|
+
"pyautogui",
|
|
24
28
|
"puppeteer",
|
|
25
29
|
"chatgpt",
|
|
26
30
|
"copilot",
|
|
@@ -33,6 +37,8 @@
|
|
|
33
37
|
},
|
|
34
38
|
"files": [
|
|
35
39
|
"dist",
|
|
40
|
+
"src/desktop",
|
|
41
|
+
"requirements.txt",
|
|
36
42
|
"README.md"
|
|
37
43
|
],
|
|
38
44
|
"engines": {
|
|
@@ -41,8 +47,10 @@
|
|
|
41
47
|
"scripts": {
|
|
42
48
|
"start": "node dist/index.js",
|
|
43
49
|
"dev": "ts-node src/index.ts",
|
|
44
|
-
"build": "tsc",
|
|
50
|
+
"build": "tsc && npm run copy-desktop",
|
|
51
|
+
"copy-desktop": "mkdir -p dist/desktop && cp src/desktop/*.py dist/desktop/",
|
|
45
52
|
"postbuild": "chmod +x dist/index.js",
|
|
53
|
+
"postinstall": "pip3 install -r requirements.txt --quiet || echo 'Note: Install Python deps manually: pip install -r requirements.txt'",
|
|
46
54
|
"prepublishOnly": "npm run build",
|
|
47
55
|
"test": "node dist/index.js test"
|
|
48
56
|
},
|
package/requirements.txt
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
V16 Desktop Control - Full computer control via Python
|
|
4
|
+
Handles: screen capture, mouse, keyboard, windows, clipboard
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import json
|
|
9
|
+
import base64
|
|
10
|
+
import io
|
|
11
|
+
import time
|
|
12
|
+
import subprocess
|
|
13
|
+
import platform
|
|
14
|
+
|
|
15
|
+
# Lazy imports to handle missing dependencies gracefully
|
|
16
|
+
pyautogui = None
|
|
17
|
+
mss = None
|
|
18
|
+
pyperclip = None
|
|
19
|
+
|
|
20
|
+
def init_deps():
|
|
21
|
+
"""Initialize dependencies"""
|
|
22
|
+
global pyautogui, mss, pyperclip
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
import pyautogui as _pyautogui
|
|
26
|
+
pyautogui = _pyautogui
|
|
27
|
+
pyautogui.FAILSAFE = False
|
|
28
|
+
pyautogui.PAUSE = 0.1
|
|
29
|
+
except ImportError:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
import mss as _mss
|
|
34
|
+
mss = _mss
|
|
35
|
+
except ImportError:
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
import pyperclip as _pyperclip
|
|
40
|
+
pyperclip = _pyperclip
|
|
41
|
+
except ImportError:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
init_deps()
|
|
45
|
+
|
|
46
|
+
# ============ Screen Capture ============
|
|
47
|
+
|
|
48
|
+
def screenshot(region=None):
|
|
49
|
+
"""Capture screenshot of full screen or region"""
|
|
50
|
+
try:
|
|
51
|
+
if mss:
|
|
52
|
+
with mss.mss() as sct:
|
|
53
|
+
if region:
|
|
54
|
+
monitor = {"left": region["x"], "top": region["y"],
|
|
55
|
+
"width": region["width"], "height": region["height"]}
|
|
56
|
+
else:
|
|
57
|
+
monitor = sct.monitors[0]
|
|
58
|
+
|
|
59
|
+
img = sct.grab(monitor)
|
|
60
|
+
|
|
61
|
+
from PIL import Image
|
|
62
|
+
pil_img = Image.frombytes("RGB", img.size, img.bgra, "raw", "BGRX")
|
|
63
|
+
buffer = io.BytesIO()
|
|
64
|
+
pil_img.save(buffer, format="PNG", optimize=True)
|
|
65
|
+
b64 = base64.b64encode(buffer.getvalue()).decode()
|
|
66
|
+
|
|
67
|
+
return {"success": True, "image": f"data:image/png;base64,{b64}",
|
|
68
|
+
"width": img.width, "height": img.height}
|
|
69
|
+
|
|
70
|
+
elif pyautogui:
|
|
71
|
+
img = pyautogui.screenshot(region=region)
|
|
72
|
+
buffer = io.BytesIO()
|
|
73
|
+
img.save(buffer, format="PNG")
|
|
74
|
+
b64 = base64.b64encode(buffer.getvalue()).decode()
|
|
75
|
+
return {"success": True, "image": f"data:image/png;base64,{b64}",
|
|
76
|
+
"width": img.width, "height": img.height}
|
|
77
|
+
|
|
78
|
+
return {"success": False, "error": "No screen capture library available"}
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
return {"success": False, "error": str(e)}
|
|
82
|
+
|
|
83
|
+
def get_screen_size():
|
|
84
|
+
"""Get screen dimensions"""
|
|
85
|
+
try:
|
|
86
|
+
if pyautogui:
|
|
87
|
+
size = pyautogui.size()
|
|
88
|
+
return {"success": True, "width": size.width, "height": size.height}
|
|
89
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
90
|
+
except Exception as e:
|
|
91
|
+
return {"success": False, "error": str(e)}
|
|
92
|
+
|
|
93
|
+
def get_mouse_position():
|
|
94
|
+
"""Get current mouse position"""
|
|
95
|
+
try:
|
|
96
|
+
if pyautogui:
|
|
97
|
+
pos = pyautogui.position()
|
|
98
|
+
return {"success": True, "x": pos.x, "y": pos.y}
|
|
99
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
100
|
+
except Exception as e:
|
|
101
|
+
return {"success": False, "error": str(e)}
|
|
102
|
+
|
|
103
|
+
# ============ Mouse Control ============
|
|
104
|
+
|
|
105
|
+
def mouse_move(x, y, duration=0.2):
|
|
106
|
+
"""Move mouse to coordinates"""
|
|
107
|
+
try:
|
|
108
|
+
if pyautogui:
|
|
109
|
+
pyautogui.moveTo(x, y, duration=duration)
|
|
110
|
+
return {"success": True, "x": x, "y": y}
|
|
111
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
112
|
+
except Exception as e:
|
|
113
|
+
return {"success": False, "error": str(e)}
|
|
114
|
+
|
|
115
|
+
def mouse_click(x=None, y=None, button="left", clicks=1):
|
|
116
|
+
"""Click at position"""
|
|
117
|
+
try:
|
|
118
|
+
if pyautogui:
|
|
119
|
+
if x is not None and y is not None:
|
|
120
|
+
pyautogui.click(x, y, clicks=clicks, button=button)
|
|
121
|
+
else:
|
|
122
|
+
pyautogui.click(clicks=clicks, button=button)
|
|
123
|
+
return {"success": True}
|
|
124
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
125
|
+
except Exception as e:
|
|
126
|
+
return {"success": False, "error": str(e)}
|
|
127
|
+
|
|
128
|
+
def mouse_double_click(x=None, y=None):
|
|
129
|
+
"""Double click at position"""
|
|
130
|
+
return mouse_click(x, y, clicks=2)
|
|
131
|
+
|
|
132
|
+
def mouse_right_click(x=None, y=None):
|
|
133
|
+
"""Right click at position"""
|
|
134
|
+
return mouse_click(x, y, button="right")
|
|
135
|
+
|
|
136
|
+
def mouse_drag(start_x, start_y, end_x, end_y, duration=0.5):
|
|
137
|
+
"""Drag from start to end position"""
|
|
138
|
+
try:
|
|
139
|
+
if pyautogui:
|
|
140
|
+
pyautogui.moveTo(start_x, start_y)
|
|
141
|
+
pyautogui.drag(end_x - start_x, end_y - start_y, duration=duration)
|
|
142
|
+
return {"success": True}
|
|
143
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
144
|
+
except Exception as e:
|
|
145
|
+
return {"success": False, "error": str(e)}
|
|
146
|
+
|
|
147
|
+
def mouse_scroll(amount, x=None, y=None):
|
|
148
|
+
"""Scroll at position (positive=up, negative=down)"""
|
|
149
|
+
try:
|
|
150
|
+
if pyautogui:
|
|
151
|
+
if x is not None and y is not None:
|
|
152
|
+
pyautogui.moveTo(x, y)
|
|
153
|
+
pyautogui.scroll(amount)
|
|
154
|
+
return {"success": True}
|
|
155
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
156
|
+
except Exception as e:
|
|
157
|
+
return {"success": False, "error": str(e)}
|
|
158
|
+
|
|
159
|
+
# ============ Keyboard Control ============
|
|
160
|
+
|
|
161
|
+
def keyboard_type(text, interval=0.02):
|
|
162
|
+
"""Type text"""
|
|
163
|
+
try:
|
|
164
|
+
if pyautogui:
|
|
165
|
+
# Use write for unicode support
|
|
166
|
+
pyautogui.write(text, interval=interval)
|
|
167
|
+
return {"success": True}
|
|
168
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
169
|
+
except Exception as e:
|
|
170
|
+
return {"success": False, "error": str(e)}
|
|
171
|
+
|
|
172
|
+
def keyboard_press(key):
|
|
173
|
+
"""Press a single key"""
|
|
174
|
+
try:
|
|
175
|
+
if pyautogui:
|
|
176
|
+
pyautogui.press(key)
|
|
177
|
+
return {"success": True}
|
|
178
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
179
|
+
except Exception as e:
|
|
180
|
+
return {"success": False, "error": str(e)}
|
|
181
|
+
|
|
182
|
+
def keyboard_hotkey(*keys):
|
|
183
|
+
"""Press key combination (e.g., 'command', 'c' for Cmd+C)"""
|
|
184
|
+
try:
|
|
185
|
+
if pyautogui:
|
|
186
|
+
pyautogui.hotkey(*keys)
|
|
187
|
+
return {"success": True}
|
|
188
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
189
|
+
except Exception as e:
|
|
190
|
+
return {"success": False, "error": str(e)}
|
|
191
|
+
|
|
192
|
+
def keyboard_key_down(key):
|
|
193
|
+
"""Hold key down"""
|
|
194
|
+
try:
|
|
195
|
+
if pyautogui:
|
|
196
|
+
pyautogui.keyDown(key)
|
|
197
|
+
return {"success": True}
|
|
198
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
199
|
+
except Exception as e:
|
|
200
|
+
return {"success": False, "error": str(e)}
|
|
201
|
+
|
|
202
|
+
def keyboard_key_up(key):
|
|
203
|
+
"""Release key"""
|
|
204
|
+
try:
|
|
205
|
+
if pyautogui:
|
|
206
|
+
pyautogui.keyUp(key)
|
|
207
|
+
return {"success": True}
|
|
208
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
209
|
+
except Exception as e:
|
|
210
|
+
return {"success": False, "error": str(e)}
|
|
211
|
+
|
|
212
|
+
# ============ Clipboard ============
|
|
213
|
+
|
|
214
|
+
def clipboard_read():
|
|
215
|
+
"""Read clipboard content"""
|
|
216
|
+
try:
|
|
217
|
+
if pyperclip:
|
|
218
|
+
content = pyperclip.paste()
|
|
219
|
+
return {"success": True, "content": content}
|
|
220
|
+
|
|
221
|
+
if platform.system() == "Darwin":
|
|
222
|
+
result = subprocess.run(["pbpaste"], capture_output=True, text=True)
|
|
223
|
+
return {"success": True, "content": result.stdout}
|
|
224
|
+
|
|
225
|
+
return {"success": False, "error": "No clipboard library available"}
|
|
226
|
+
except Exception as e:
|
|
227
|
+
return {"success": False, "error": str(e)}
|
|
228
|
+
|
|
229
|
+
def clipboard_write(content):
|
|
230
|
+
"""Write to clipboard"""
|
|
231
|
+
try:
|
|
232
|
+
if pyperclip:
|
|
233
|
+
pyperclip.copy(content)
|
|
234
|
+
return {"success": True}
|
|
235
|
+
|
|
236
|
+
if platform.system() == "Darwin":
|
|
237
|
+
subprocess.run(["pbcopy"], input=content.encode(), check=True)
|
|
238
|
+
return {"success": True}
|
|
239
|
+
|
|
240
|
+
return {"success": False, "error": "No clipboard library available"}
|
|
241
|
+
except Exception as e:
|
|
242
|
+
return {"success": False, "error": str(e)}
|
|
243
|
+
|
|
244
|
+
# ============ Window Management ============
|
|
245
|
+
|
|
246
|
+
def window_list():
|
|
247
|
+
"""List all open windows"""
|
|
248
|
+
try:
|
|
249
|
+
if platform.system() == "Darwin":
|
|
250
|
+
script = '''
|
|
251
|
+
tell application "System Events"
|
|
252
|
+
set windowList to {}
|
|
253
|
+
repeat with proc in (every process whose visible is true)
|
|
254
|
+
set procName to name of proc
|
|
255
|
+
repeat with win in (every window of proc)
|
|
256
|
+
set winName to name of win
|
|
257
|
+
set end of windowList to procName & ": " & winName
|
|
258
|
+
end repeat
|
|
259
|
+
end repeat
|
|
260
|
+
return windowList
|
|
261
|
+
end tell
|
|
262
|
+
'''
|
|
263
|
+
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
|
264
|
+
windows = result.stdout.strip().split(", ")
|
|
265
|
+
return {"success": True, "windows": windows}
|
|
266
|
+
|
|
267
|
+
return {"success": False, "error": "Window listing only supported on macOS"}
|
|
268
|
+
except Exception as e:
|
|
269
|
+
return {"success": False, "error": str(e)}
|
|
270
|
+
|
|
271
|
+
def window_focus(app_name):
|
|
272
|
+
"""Focus/activate an application window"""
|
|
273
|
+
try:
|
|
274
|
+
if platform.system() == "Darwin":
|
|
275
|
+
script = f'tell application "{app_name}" to activate'
|
|
276
|
+
subprocess.run(["osascript", "-e", script], check=True)
|
|
277
|
+
return {"success": True}
|
|
278
|
+
|
|
279
|
+
return {"success": False, "error": "Window focus only supported on macOS"}
|
|
280
|
+
except Exception as e:
|
|
281
|
+
return {"success": False, "error": str(e)}
|
|
282
|
+
|
|
283
|
+
def window_bounds(app_name):
|
|
284
|
+
"""Get window position and size"""
|
|
285
|
+
try:
|
|
286
|
+
if platform.system() == "Darwin":
|
|
287
|
+
script = f'''
|
|
288
|
+
tell application "System Events"
|
|
289
|
+
tell process "{app_name}"
|
|
290
|
+
set frontWindow to front window
|
|
291
|
+
set pos to position of frontWindow
|
|
292
|
+
set sz to size of frontWindow
|
|
293
|
+
return (item 1 of pos) & "," & (item 2 of pos) & "," & (item 1 of sz) & "," & (item 2 of sz)
|
|
294
|
+
end tell
|
|
295
|
+
end tell
|
|
296
|
+
'''
|
|
297
|
+
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
|
298
|
+
parts = result.stdout.strip().split(",")
|
|
299
|
+
return {"success": True, "x": int(parts[0]), "y": int(parts[1]),
|
|
300
|
+
"width": int(parts[2]), "height": int(parts[3])}
|
|
301
|
+
|
|
302
|
+
return {"success": False, "error": "Window bounds only supported on macOS"}
|
|
303
|
+
except Exception as e:
|
|
304
|
+
return {"success": False, "error": str(e)}
|
|
305
|
+
|
|
306
|
+
# ============ Utilities ============
|
|
307
|
+
|
|
308
|
+
def wait(seconds):
|
|
309
|
+
"""Wait/sleep"""
|
|
310
|
+
time.sleep(seconds)
|
|
311
|
+
return {"success": True}
|
|
312
|
+
|
|
313
|
+
def locate_on_screen(image_path, confidence=0.9):
|
|
314
|
+
"""Find image on screen and return its position"""
|
|
315
|
+
try:
|
|
316
|
+
if pyautogui:
|
|
317
|
+
try:
|
|
318
|
+
location = pyautogui.locateOnScreen(image_path, confidence=confidence)
|
|
319
|
+
except pyautogui.ImageNotFoundException:
|
|
320
|
+
return {"success": False, "error": "Image not found on screen"}
|
|
321
|
+
|
|
322
|
+
if location:
|
|
323
|
+
center = pyautogui.center(location)
|
|
324
|
+
return {"success": True, "x": center.x, "y": center.y,
|
|
325
|
+
"left": location.left, "top": location.top,
|
|
326
|
+
"width": location.width, "height": location.height}
|
|
327
|
+
return {"success": False, "error": "Image not found on screen"}
|
|
328
|
+
return {"success": False, "error": "pyautogui not available"}
|
|
329
|
+
except Exception as e:
|
|
330
|
+
return {"success": False, "error": str(e)}
|
|
331
|
+
|
|
332
|
+
# ============ Main Handler ============
|
|
333
|
+
|
|
334
|
+
COMMANDS = {
|
|
335
|
+
"screenshot": screenshot,
|
|
336
|
+
"screen_size": get_screen_size,
|
|
337
|
+
"mouse_position": get_mouse_position,
|
|
338
|
+
"mouse_move": mouse_move,
|
|
339
|
+
"mouse_click": mouse_click,
|
|
340
|
+
"mouse_double_click": mouse_double_click,
|
|
341
|
+
"mouse_right_click": mouse_right_click,
|
|
342
|
+
"mouse_drag": mouse_drag,
|
|
343
|
+
"mouse_scroll": mouse_scroll,
|
|
344
|
+
"keyboard_type": keyboard_type,
|
|
345
|
+
"keyboard_press": keyboard_press,
|
|
346
|
+
"keyboard_hotkey": keyboard_hotkey,
|
|
347
|
+
"keyboard_key_down": keyboard_key_down,
|
|
348
|
+
"keyboard_key_up": keyboard_key_up,
|
|
349
|
+
"clipboard_read": clipboard_read,
|
|
350
|
+
"clipboard_write": clipboard_write,
|
|
351
|
+
"window_list": window_list,
|
|
352
|
+
"window_focus": window_focus,
|
|
353
|
+
"window_bounds": window_bounds,
|
|
354
|
+
"wait": wait,
|
|
355
|
+
"locate_on_screen": locate_on_screen,
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
def handle_command(cmd_data):
|
|
359
|
+
"""Handle incoming command"""
|
|
360
|
+
cmd_type = cmd_data.get("type")
|
|
361
|
+
payload = cmd_data.get("payload", {})
|
|
362
|
+
|
|
363
|
+
if cmd_type not in COMMANDS:
|
|
364
|
+
return {"success": False, "error": f"Unknown command: {cmd_type}"}
|
|
365
|
+
|
|
366
|
+
try:
|
|
367
|
+
func = COMMANDS[cmd_type]
|
|
368
|
+
if payload:
|
|
369
|
+
result = func(**payload)
|
|
370
|
+
else:
|
|
371
|
+
result = func()
|
|
372
|
+
return result
|
|
373
|
+
except TypeError as e:
|
|
374
|
+
return {"success": False, "error": f"Invalid arguments: {str(e)}"}
|
|
375
|
+
except Exception as e:
|
|
376
|
+
return {"success": False, "error": str(e)}
|
|
377
|
+
|
|
378
|
+
def main():
|
|
379
|
+
"""Main entry - reads JSON from stdin, writes result to stdout"""
|
|
380
|
+
try:
|
|
381
|
+
input_data = sys.stdin.read()
|
|
382
|
+
cmd_data = json.loads(input_data)
|
|
383
|
+
result = handle_command(cmd_data)
|
|
384
|
+
print(json.dumps(result))
|
|
385
|
+
except json.JSONDecodeError as e:
|
|
386
|
+
print(json.dumps({"success": False, "error": f"Invalid JSON: {str(e)}"}))
|
|
387
|
+
except Exception as e:
|
|
388
|
+
print(json.dumps({"success": False, "error": str(e)}))
|
|
389
|
+
|
|
390
|
+
if __name__ == "__main__":
|
|
391
|
+
main()
|