use-computer 0.0.16__tar.gz → 0.0.18__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.
- {use_computer-0.0.16 → use_computer-0.0.18}/PKG-INFO +22 -8
- {use_computer-0.0.16 → use_computer-0.0.18}/README.md +21 -7
- use_computer-0.0.18/examples/_2_hello_ios.py +11 -0
- use_computer-0.0.18/examples/_6_hello_tvos.py +11 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/pyproject.toml +1 -1
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/ios/input.py +18 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/sandbox.py +1 -1
- use_computer-0.0.16/examples/_2_hello_ios.py +0 -7
- {use_computer-0.0.16 → use_computer-0.0.18}/.env.example +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/.gitignore +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/.pre-commit-config.yaml +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/examples/_1_hello_macos.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/examples/_3_recording.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/examples/_4_file_transfer.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/examples/_5_keepalive.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/__init__.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/accessibility.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/ax_transpile.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/client.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/display.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/errors.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/ios/__init__.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/ios/apps.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/ios/environment.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/macos/__init__.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/macos/keyboard.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/macos/mouse.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/models.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/parsers.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/py.typed +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/recording.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/retry.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/screenshot.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/simulators.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/__init__.py +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/pre_command.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/task.toml +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_ios.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_ios_nograder.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_macos.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_macos_check.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_macos_nograder.sh +0 -0
- {use_computer-0.0.16 → use_computer-0.0.18}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: use-computer
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.18
|
|
4
4
|
Summary: Python SDK for the use.computer macOS and iOS Computer Use API
|
|
5
5
|
Project-URL: Homepage, https://use.computer
|
|
6
6
|
Project-URL: Documentation, https://api.use.computer/docs
|
|
@@ -40,6 +40,9 @@ with Computer().create() as mac:
|
|
|
40
40
|
with Computer().create(type=SandboxType.IOS, family=SimulatorFamily.TV) as tv:
|
|
41
41
|
tv.screenshot.take_full_screen()
|
|
42
42
|
tv.input.press_remote("select")
|
|
43
|
+
|
|
44
|
+
with Computer().create(type=SandboxType.IOS) as ios:
|
|
45
|
+
ios.input.long_press(120, 300, duration=1.0)
|
|
43
46
|
```
|
|
44
47
|
|
|
45
48
|
Full DSL reference (macOS + simulator): [docs.use.computer/docs/sdk](https://docs.use.computer/docs/sdk)
|
|
@@ -54,15 +57,26 @@ iPhone 17 Pro on the latest installed iOS runtime.
|
|
|
54
57
|
Known-incompatible simulator types are filtered from family selection,
|
|
55
58
|
including the non-4K Apple Vision Pro type on current fleet runtimes.
|
|
56
59
|
|
|
60
|
+
### Per-family input
|
|
61
|
+
|
|
62
|
+
iPhone / iPad sims have full touch + on-screen keyboard. Apple Watch supports
|
|
63
|
+
touch + crown / button (no `type_text` — watchOS keyboard isn't exposed). Apple
|
|
64
|
+
TV has no touch — drive it with `input.press_remote(RemoteButton.SELECT)` (the
|
|
65
|
+
remote D-pad, select, menu, home, play/pause). **Apple Vision (visionOS) is
|
|
66
|
+
BETA**: sessions display and you can screenshot / launch apps, but
|
|
67
|
+
`input.tap` is a no-op because there's no XCTest-free coordinate tap path on
|
|
68
|
+
visionOS yet. Use it for read-only flows for now.
|
|
69
|
+
|
|
57
70
|
## Examples
|
|
58
71
|
|
|
59
|
-
| File | What it shows
|
|
60
|
-
| -------------------------------------------------------------- |
|
|
61
|
-
| [`examples/_1_hello_macos.py`](examples/_1_hello_macos.py) | create → exec → keyboard → screenshot
|
|
62
|
-
| [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create
|
|
63
|
-
| [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording
|
|
64
|
-
| [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back
|
|
65
|
-
| [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min
|
|
72
|
+
| File | What it shows |
|
|
73
|
+
| -------------------------------------------------------------- | ---------------------------------------------- |
|
|
74
|
+
| [`examples/_1_hello_macos.py`](examples/_1_hello_macos.py) | create → exec → keyboard → screenshot |
|
|
75
|
+
| [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create iPhone sim → open URL → screenshot |
|
|
76
|
+
| [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording |
|
|
77
|
+
| [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back |
|
|
78
|
+
| [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min |
|
|
79
|
+
| [`examples/_6_hello_tvos.py`](examples/_6_hello_tvos.py) | tvOS: pick TV family + drive the Apple Remote |
|
|
66
80
|
|
|
67
81
|
For agent loops and evals: [use-computer-cookbook](https://github.com/josancamon19/use-computer-cookbook).
|
|
68
82
|
|
|
@@ -18,6 +18,9 @@ with Computer().create() as mac:
|
|
|
18
18
|
with Computer().create(type=SandboxType.IOS, family=SimulatorFamily.TV) as tv:
|
|
19
19
|
tv.screenshot.take_full_screen()
|
|
20
20
|
tv.input.press_remote("select")
|
|
21
|
+
|
|
22
|
+
with Computer().create(type=SandboxType.IOS) as ios:
|
|
23
|
+
ios.input.long_press(120, 300, duration=1.0)
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
Full DSL reference (macOS + simulator): [docs.use.computer/docs/sdk](https://docs.use.computer/docs/sdk)
|
|
@@ -32,15 +35,26 @@ iPhone 17 Pro on the latest installed iOS runtime.
|
|
|
32
35
|
Known-incompatible simulator types are filtered from family selection,
|
|
33
36
|
including the non-4K Apple Vision Pro type on current fleet runtimes.
|
|
34
37
|
|
|
38
|
+
### Per-family input
|
|
39
|
+
|
|
40
|
+
iPhone / iPad sims have full touch + on-screen keyboard. Apple Watch supports
|
|
41
|
+
touch + crown / button (no `type_text` — watchOS keyboard isn't exposed). Apple
|
|
42
|
+
TV has no touch — drive it with `input.press_remote(RemoteButton.SELECT)` (the
|
|
43
|
+
remote D-pad, select, menu, home, play/pause). **Apple Vision (visionOS) is
|
|
44
|
+
BETA**: sessions display and you can screenshot / launch apps, but
|
|
45
|
+
`input.tap` is a no-op because there's no XCTest-free coordinate tap path on
|
|
46
|
+
visionOS yet. Use it for read-only flows for now.
|
|
47
|
+
|
|
35
48
|
## Examples
|
|
36
49
|
|
|
37
|
-
| File | What it shows
|
|
38
|
-
| -------------------------------------------------------------- |
|
|
39
|
-
| [`examples/_1_hello_macos.py`](examples/_1_hello_macos.py) | create → exec → keyboard → screenshot
|
|
40
|
-
| [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create
|
|
41
|
-
| [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording
|
|
42
|
-
| [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back
|
|
43
|
-
| [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min
|
|
50
|
+
| File | What it shows |
|
|
51
|
+
| -------------------------------------------------------------- | ---------------------------------------------- |
|
|
52
|
+
| [`examples/_1_hello_macos.py`](examples/_1_hello_macos.py) | create → exec → keyboard → screenshot |
|
|
53
|
+
| [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create iPhone sim → open URL → screenshot |
|
|
54
|
+
| [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording |
|
|
55
|
+
| [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back |
|
|
56
|
+
| [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min |
|
|
57
|
+
| [`examples/_6_hello_tvos.py`](examples/_6_hello_tvos.py) | tvOS: pick TV family + drive the Apple Remote |
|
|
44
58
|
|
|
45
59
|
For agent loops and evals: [use-computer-cookbook](https://github.com/josancamon19/use-computer-cookbook).
|
|
46
60
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from use_computer import Computer, SandboxType, SimulatorFamily
|
|
2
|
+
|
|
3
|
+
# iPhone is the default when family= is omitted. Pass family= to target a
|
|
4
|
+
# different simulator family (iPad, Apple Watch, Apple TV, Apple Vision); the
|
|
5
|
+
# SDK picks a compatible installed device_type + runtime pair for you. See
|
|
6
|
+
# _6_hello_tvos.py for an Apple TV walkthrough.
|
|
7
|
+
with Computer().create(type=SandboxType.IOS, family=SimulatorFamily.IPHONE) as ios:
|
|
8
|
+
ios.apps.open_url("https://example.com")
|
|
9
|
+
png = ios.screenshot.take_full_screen()
|
|
10
|
+
open("hello_ios.png", "wb").write(png)
|
|
11
|
+
print(f"saved hello_ios.png ({len(png)} bytes)")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from use_computer import Computer, RemoteButton, SandboxType, SimulatorFamily
|
|
2
|
+
|
|
3
|
+
# tvOS sims have no touch — drive them with the remote (D-pad + select / menu /
|
|
4
|
+
# home). `press_remote` accepts the enum or a string.
|
|
5
|
+
with Computer().create(type=SandboxType.IOS, family=SimulatorFamily.TV) as tv:
|
|
6
|
+
tv.input.press_remote(RemoteButton.DOWN)
|
|
7
|
+
tv.input.press_remote(RemoteButton.DOWN)
|
|
8
|
+
tv.input.press_remote(RemoteButton.SELECT)
|
|
9
|
+
png = tv.screenshot.take_full_screen()
|
|
10
|
+
open("hello_tvos.png", "wb").write(png)
|
|
11
|
+
print(f"saved hello_tvos.png ({len(png)} bytes)")
|
|
@@ -65,6 +65,15 @@ class Input:
|
|
|
65
65
|
resp.raise_for_status()
|
|
66
66
|
return ActionResult.from_dict(resp.json())
|
|
67
67
|
|
|
68
|
+
def long_press(self, x: float, y: float, duration: float = 1.0) -> ActionResult:
|
|
69
|
+
"""Hold a touch at coordinates for duration seconds."""
|
|
70
|
+
resp = self._http.post(
|
|
71
|
+
f"{self._prefix}/long_press",
|
|
72
|
+
json={"x": x, "y": y, "duration": duration},
|
|
73
|
+
)
|
|
74
|
+
resp.raise_for_status()
|
|
75
|
+
return ActionResult.from_dict(resp.json())
|
|
76
|
+
|
|
68
77
|
def swipe(self, from_x: float, from_y: float, to_x: float, to_y: float) -> ActionResult:
|
|
69
78
|
resp = self._http.post(
|
|
70
79
|
f"{self._prefix}/swipe",
|
|
@@ -110,6 +119,15 @@ class AsyncInput:
|
|
|
110
119
|
resp.raise_for_status()
|
|
111
120
|
return ActionResult.from_dict(resp.json())
|
|
112
121
|
|
|
122
|
+
async def long_press(self, x: float, y: float, duration: float = 1.0) -> ActionResult:
|
|
123
|
+
"""Hold a touch at coordinates for duration seconds."""
|
|
124
|
+
resp = await self._http.post(
|
|
125
|
+
f"{self._prefix}/long_press",
|
|
126
|
+
json={"x": x, "y": y, "duration": duration},
|
|
127
|
+
)
|
|
128
|
+
resp.raise_for_status()
|
|
129
|
+
return ActionResult.from_dict(resp.json())
|
|
130
|
+
|
|
113
131
|
async def swipe(self, from_x: float, from_y: float, to_x: float, to_y: float) -> ActionResult:
|
|
114
132
|
resp = await self._http.post(
|
|
115
133
|
f"{self._prefix}/swipe",
|
|
@@ -243,7 +243,7 @@ class MacOSSandbox(Sandbox):
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
class IOSSandbox(Sandbox):
|
|
246
|
-
"""iOS simulator sandbox — tap, swipe,
|
|
246
|
+
"""iOS simulator sandbox — tap, long press, swipe, buttons, apps."""
|
|
247
247
|
|
|
248
248
|
def __init__(self, sandbox_id: str, http: httpx.Client):
|
|
249
249
|
super().__init__(sandbox_id, SandboxType.IOS, http)
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
from use_computer import Computer, SandboxType
|
|
2
|
-
|
|
3
|
-
with Computer().create(type=SandboxType.IOS) as ios:
|
|
4
|
-
ios.apps.open_url("https://example.com")
|
|
5
|
-
png = ios.screenshot.take_full_screen()
|
|
6
|
-
open("hello_ios.png", "wb").write(png)
|
|
7
|
-
print(f"saved hello_ios.png ({len(png)} bytes)")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_ios_nograder.sh
RENAMED
|
File without changes
|
|
File without changes
|
{use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_macos_check.sh
RENAMED
|
File without changes
|
{use_computer-0.0.16 → use_computer-0.0.18}/use_computer/tasks/templates/test_macos_nograder.sh
RENAMED
|
File without changes
|
|
File without changes
|