use-computer 0.0.42__tar.gz → 0.0.44__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.
Files changed (89) hide show
  1. {use_computer-0.0.42 → use_computer-0.0.44}/PKG-INFO +7 -2
  2. {use_computer-0.0.42 → use_computer-0.0.44}/README.md +6 -1
  3. {use_computer-0.0.42 → use_computer-0.0.44}/pyproject.toml +1 -1
  4. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/client.py +20 -4
  5. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/sandbox.py +33 -6
  6. {use_computer-0.0.42 → use_computer-0.0.44}/.env.example +0 -0
  7. {use_computer-0.0.42 → use_computer-0.0.44}/.gitignore +0 -0
  8. {use_computer-0.0.42 → use_computer-0.0.44}/.pre-commit-config.yaml +0 -0
  9. {use_computer-0.0.42 → use_computer-0.0.44}/scripts/smoke_wheel.py +0 -0
  10. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/__init__.py +0 -0
  11. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/__init__.py +0 -0
  12. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/__init__.py +0 -0
  13. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/actions.py +0 -0
  14. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/agent.py +0 -0
  15. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/artifacts.py +0 -0
  16. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/desktop.py +0 -0
  17. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/final_state.py +0 -0
  18. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/prompts.py +0 -0
  19. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/recordings.py +0 -0
  20. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/sandbox.py +0 -0
  21. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/screenshots.py +0 -0
  22. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/task_setup.py +0 -0
  23. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/base/trajectory.py +0 -0
  24. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/core.py +0 -0
  25. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/debug/README.md +0 -0
  26. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/debug/__init__.py +0 -0
  27. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/debug/actions.py +0 -0
  28. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/debug/agent.py +0 -0
  29. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/debug/models.py +0 -0
  30. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/ios/__init__.py +0 -0
  31. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/ios/agent.py +0 -0
  32. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/ios/tools.py +0 -0
  33. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/anthropic.txt +0 -0
  34. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/gemini.txt +0 -0
  35. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/ios.txt +0 -0
  36. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/openai.txt +0 -0
  37. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/osworld_pyautogui.txt +0 -0
  38. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/prompts/pyautogui.txt +0 -0
  39. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/__init__.py +0 -0
  40. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/anthropic.py +0 -0
  41. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/gemini.py +0 -0
  42. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/generic.py +0 -0
  43. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/openai.py +0 -0
  44. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/osworld.py +0 -0
  45. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/providers/tinker_backend.py +0 -0
  46. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/agents/types.py +0 -0
  47. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/automation/__init__.py +0 -0
  48. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/automation/ax_transpile.py +0 -0
  49. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/automation/osworld.py +0 -0
  50. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/automation/parsers.py +0 -0
  51. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/__init__.py +0 -0
  52. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/errors.py +0 -0
  53. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/models.py +0 -0
  54. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/core/retry.py +0 -0
  55. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/harbor/__init__.py +0 -0
  56. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/harbor/agents.py +0 -0
  57. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/ios/__init__.py +0 -0
  58. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/ios/apps.py +0 -0
  59. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/ios/environment.py +0 -0
  60. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/ios/input.py +0 -0
  61. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/ios/simulators.py +0 -0
  62. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/macos/__init__.py +0 -0
  63. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/macos/keyboard.py +0 -0
  64. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/macos/mouse.py +0 -0
  65. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/py.typed +0 -0
  66. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/resources/__init__.py +0 -0
  67. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/resources/accessibility.py +0 -0
  68. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/resources/display.py +0 -0
  69. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/resources/recording.py +0 -0
  70. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/resources/screenshot.py +0 -0
  71. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/setup_files.py +0 -0
  72. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/__init__.py +0 -0
  73. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/pre_command.ps1 +0 -0
  74. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/pre_command.sh +0 -0
  75. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/task.toml +0 -0
  76. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_ios.sh +0 -0
  77. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_ios_nograder.sh +0 -0
  78. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_macos.sh +0 -0
  79. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_macos_check.sh +0 -0
  80. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_macos_nograder.sh +0 -0
  81. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_ubuntu.sh +0 -0
  82. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_ubuntu_check.sh +0 -0
  83. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_ubuntu_nograder.sh +0 -0
  84. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_windows.sh +0 -0
  85. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_windows_check.sh +0 -0
  86. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/tasks/templates/test_windows_nograder.sh +0 -0
  87. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/windows/__init__.py +0 -0
  88. {use_computer-0.0.42 → use_computer-0.0.44}/use_computer/windows/shell.py +0 -0
  89. {use_computer-0.0.42 → use_computer-0.0.44}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: use-computer
3
- Version: 0.0.42
3
+ Version: 0.0.44
4
4
  Summary: Python SDK for use.computer sandboxes across macOS, iOS simulators, Windows, and Ubuntu
5
5
  Project-URL: Homepage, https://use.computer
6
6
  Project-URL: Documentation, https://api.use.computer/docs
@@ -53,6 +53,11 @@ Base installs only the SDK client and `httpx`. The `agents` extra installs the
53
53
  agent runtime plus model-provider dependencies; `harbor` installs Harbor for
54
54
  `use_computer.harbor.agents`.
55
55
 
56
+ Sandboxes default to `ephemeral=True`, so they are deleted after roughly 2
57
+ minutes without activity. Use `ephemeral=False` when a sandbox should persist
58
+ until manual deletion, or call `sandbox.start_keepalive(interval=30)` during
59
+ long model-think/install periods.
60
+
56
61
  ```python
57
62
  from use_computer.agents import AnthropicComputerAgent
58
63
  ```
@@ -202,7 +207,7 @@ visionOS yet. Use it for read-only flows for now.
202
207
  | [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create iPhone sim → open URL → screenshot |
203
208
  | [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording |
204
209
  | [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back |
205
- | [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min |
210
+ | [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for ephemeral sessions idle > 2 min |
206
211
  | [`examples/_6_hello_tvos.py`](examples/_6_hello_tvos.py) | tvOS: pick TV family + drive the Apple Remote |
207
212
  | [`examples/_7_hello_windows.py`](examples/_7_hello_windows.py) | create Windows → run PowerShell → screenshot |
208
213
  | [`examples/_8_hello_ubuntu.py`](examples/_8_hello_ubuntu.py) | create Ubuntu → run bash → screenshot |
@@ -19,6 +19,11 @@ Base installs only the SDK client and `httpx`. The `agents` extra installs the
19
19
  agent runtime plus model-provider dependencies; `harbor` installs Harbor for
20
20
  `use_computer.harbor.agents`.
21
21
 
22
+ Sandboxes default to `ephemeral=True`, so they are deleted after roughly 2
23
+ minutes without activity. Use `ephemeral=False` when a sandbox should persist
24
+ until manual deletion, or call `sandbox.start_keepalive(interval=30)` during
25
+ long model-think/install periods.
26
+
22
27
  ```python
23
28
  from use_computer.agents import AnthropicComputerAgent
24
29
  ```
@@ -168,7 +173,7 @@ visionOS yet. Use it for read-only flows for now.
168
173
  | [`examples/_2_hello_ios.py`](examples/_2_hello_ios.py) | create iPhone sim → open URL → screenshot |
169
174
  | [`examples/_3_recording.py`](examples/_3_recording.py) | start / stop / download a screen recording |
170
175
  | [`examples/_4_file_transfer.py`](examples/_4_file_transfer.py) | upload bytes, download a file back |
171
- | [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for sessions idle > 2 min |
176
+ | [`examples/_5_keepalive.py`](examples/_5_keepalive.py) | heartbeat for ephemeral sessions idle > 2 min |
172
177
  | [`examples/_6_hello_tvos.py`](examples/_6_hello_tvos.py) | tvOS: pick TV family + drive the Apple Remote |
173
178
  | [`examples/_7_hello_windows.py`](examples/_7_hello_windows.py) | create Windows → run PowerShell → screenshot |
174
179
  | [`examples/_8_hello_ubuntu.py`](examples/_8_hello_ubuntu.py) | create Ubuntu → run bash → screenshot |
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "use-computer"
7
- version = "0.0.42"
7
+ version = "0.0.44"
8
8
  description = "Python SDK for use.computer sandboxes across macOS, iOS simulators, Windows, and Ubuntu"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -298,7 +298,11 @@ class Computer:
298
298
  sid = data["sandbox_id"]
299
299
 
300
300
  if sandbox_type == SandboxType.IOS:
301
- return IOSSandbox(sandbox_id=sid, http=self._http)
301
+ return IOSSandbox(
302
+ sandbox_id=sid,
303
+ http=self._http,
304
+ vnc_url=_absolute_url(self._base_url, data.get("vnc_url", "")),
305
+ )
302
306
  if sandbox_type == SandboxType.WINDOWS:
303
307
  return WindowsSandbox(
304
308
  sandbox_id=sid,
@@ -333,7 +337,11 @@ class Computer:
333
337
  data = resp.json()
334
338
  sb_type = SandboxType(data.get("type", "macos"))
335
339
  if sb_type == SandboxType.IOS:
336
- return IOSSandbox(sandbox_id=data["sandbox_id"], http=self._http)
340
+ return IOSSandbox(
341
+ sandbox_id=data["sandbox_id"],
342
+ http=self._http,
343
+ vnc_url=_absolute_url(self._base_url, data.get("vnc_url", "")),
344
+ )
337
345
  if sb_type == SandboxType.WINDOWS:
338
346
  return WindowsSandbox(
339
347
  sandbox_id=data["sandbox_id"],
@@ -574,7 +582,11 @@ class AsyncComputer:
574
582
  sid = data["sandbox_id"]
575
583
 
576
584
  if sandbox_type == SandboxType.IOS:
577
- return AsyncIOSSandbox(sandbox_id=sid, http=self._http)
585
+ return AsyncIOSSandbox(
586
+ sandbox_id=sid,
587
+ http=self._http,
588
+ vnc_url=_absolute_url(self._base_url, data.get("vnc_url", "")),
589
+ )
578
590
  if sandbox_type == SandboxType.WINDOWS:
579
591
  return AsyncWindowsSandbox(
580
592
  sandbox_id=sid,
@@ -609,7 +621,11 @@ class AsyncComputer:
609
621
  data = resp.json()
610
622
  sb_type = SandboxType(data.get("type", "macos"))
611
623
  if sb_type == SandboxType.IOS:
612
- return AsyncIOSSandbox(sandbox_id=data["sandbox_id"], http=self._http)
624
+ return AsyncIOSSandbox(
625
+ sandbox_id=data["sandbox_id"],
626
+ http=self._http,
627
+ vnc_url=_absolute_url(self._base_url, data.get("vnc_url", "")),
628
+ )
613
629
  if sb_type == SandboxType.WINDOWS:
614
630
  return AsyncWindowsSandbox(
615
631
  sandbox_id=data["sandbox_id"],
@@ -101,6 +101,17 @@ def _stop_keepalive_thread(
101
101
  thread.join(timeout=2)
102
102
 
103
103
 
104
+ class _CompletedAwaitable:
105
+ def __await__(self):
106
+ if False:
107
+ yield None
108
+ return None
109
+
110
+
111
+ def _keepalive_running(thread: threading.Thread | None) -> bool:
112
+ return thread is not None and thread.is_alive()
113
+
114
+
104
115
  # ---------------------------------------------------------------------------
105
116
  # Sync
106
117
  # ---------------------------------------------------------------------------
@@ -177,10 +188,17 @@ class Sandbox:
177
188
 
178
189
  def start_keepalive(self, interval: float = 30.0) -> None:
179
190
  """Start a background thread that pings the gateway every `interval` seconds."""
191
+ if _keepalive_running(self._keepalive_thread):
192
+ return
180
193
  self._keepalive_stop, self._keepalive_thread = _start_keepalive_thread(
181
194
  self._http, self._prefix, interval
182
195
  )
183
196
 
197
+ def keepalive(self) -> None:
198
+ """Reset the gateway idle timer once."""
199
+ resp = self._http.post(f"{self._prefix}/keepalive")
200
+ resp.raise_for_status()
201
+
184
202
  def stop_keepalive(self) -> None:
185
203
  """Stop the keepalive background thread."""
186
204
  _stop_keepalive_thread(self._keepalive_stop, self._keepalive_thread)
@@ -296,8 +314,8 @@ class MacOSSandbox(Sandbox):
296
314
  class IOSSandbox(Sandbox):
297
315
  """iOS simulator sandbox — tap, long press, swipe, buttons, apps."""
298
316
 
299
- def __init__(self, sandbox_id: str, http: httpx.Client):
300
- super().__init__(sandbox_id, SandboxType.IOS, http)
317
+ def __init__(self, sandbox_id: str, http: httpx.Client, vnc_url: str = ""):
318
+ super().__init__(sandbox_id, SandboxType.IOS, http, vnc_url=vnc_url)
301
319
  self.input = Input(http, self._prefix)
302
320
  self.apps = Apps(http, self._prefix)
303
321
  self.environment = Environment(http, self._prefix)
@@ -602,21 +620,30 @@ class AsyncSandbox:
602
620
  platform=data.get("platform", self.type.value),
603
621
  )
604
622
 
605
- async def start_keepalive(self, interval: float = 30.0) -> None:
623
+ def start_keepalive(self, interval: float = 30.0) -> _CompletedAwaitable:
606
624
  """Start a background OS thread that pings the gateway every `interval` seconds.
607
625
 
608
626
  Uses a real thread (not an asyncio task) so it fires reliably even when
609
627
  the event loop is blocked by sync calls (e.g. sync Anthropic client).
610
628
  """
629
+ if _keepalive_running(self._keepalive_thread):
630
+ return _CompletedAwaitable()
611
631
  self._keepalive_stop, self._keepalive_thread = _start_keepalive_thread(
612
632
  self._http, self._prefix, interval
613
633
  )
634
+ return _CompletedAwaitable()
635
+
636
+ async def keepalive(self) -> None:
637
+ """Reset the gateway idle timer once."""
638
+ resp = await self._http.post(f"{self._prefix}/keepalive")
639
+ resp.raise_for_status()
614
640
 
615
- async def stop_keepalive(self) -> None:
641
+ def stop_keepalive(self) -> _CompletedAwaitable:
616
642
  """Stop the keepalive background thread."""
617
643
  _stop_keepalive_thread(self._keepalive_stop, self._keepalive_thread)
618
644
  self._keepalive_stop = None
619
645
  self._keepalive_thread = None
646
+ return _CompletedAwaitable()
620
647
 
621
648
  async def close(self):
622
649
  await self.stop_keepalive()
@@ -717,8 +744,8 @@ class AsyncMacOSSandbox(AsyncSandbox):
717
744
  class AsyncIOSSandbox(AsyncSandbox):
718
745
  """Async iOS simulator sandbox."""
719
746
 
720
- def __init__(self, sandbox_id: str, http: httpx.AsyncClient):
721
- super().__init__(sandbox_id, SandboxType.IOS, http)
747
+ def __init__(self, sandbox_id: str, http: httpx.AsyncClient, vnc_url: str = ""):
748
+ super().__init__(sandbox_id, SandboxType.IOS, http, vnc_url=vnc_url)
722
749
  self.input = AsyncInput(http, self._prefix)
723
750
  self.apps = AsyncApps(http, self._prefix)
724
751
  self.environment = AsyncEnvironment(http, self._prefix)
File without changes
File without changes