cua-computer 0.2.10__py3-none-any.whl → 0.2.11__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.
- computer/computer.py +19 -3
- computer/interface/factory.py +6 -3
- computer/interface/windows.py +687 -0
- computer/providers/base.py +1 -0
- computer/providers/factory.py +22 -0
- computer/providers/winsandbox/__init__.py +11 -0
- computer/providers/winsandbox/provider.py +468 -0
- computer/providers/winsandbox/setup_script.ps1 +124 -0
- computer/ui/__main__.py +15 -0
- computer/ui/gradio/app.py +70 -10
- {cua_computer-0.2.10.dist-info → cua_computer-0.2.11.dist-info}/METADATA +1 -1
- {cua_computer-0.2.10.dist-info → cua_computer-0.2.11.dist-info}/RECORD +14 -9
- {cua_computer-0.2.10.dist-info → cua_computer-0.2.11.dist-info}/WHEEL +0 -0
- {cua_computer-0.2.10.dist-info → cua_computer-0.2.11.dist-info}/entry_points.txt +0 -0
computer/computer.py
CHANGED
@@ -106,7 +106,15 @@ class Computer:
|
|
106
106
|
# The default is currently to use non-ephemeral storage
|
107
107
|
if storage and ephemeral and storage != "ephemeral":
|
108
108
|
raise ValueError("Storage path and ephemeral flag cannot be used together")
|
109
|
-
|
109
|
+
|
110
|
+
# Windows Sandbox always uses ephemeral storage
|
111
|
+
if self.provider_type == VMProviderType.WINSANDBOX:
|
112
|
+
if not ephemeral and storage != None and storage != "ephemeral":
|
113
|
+
self.logger.warning("Windows Sandbox storage is always ephemeral. Setting ephemeral=True.")
|
114
|
+
self.ephemeral = True
|
115
|
+
self.storage = "ephemeral"
|
116
|
+
else:
|
117
|
+
self.storage = "ephemeral" if ephemeral else storage
|
110
118
|
|
111
119
|
# For Lumier provider, store the first shared directory path to use
|
112
120
|
# for VM file sharing
|
@@ -285,6 +293,15 @@ class Computer:
|
|
285
293
|
api_key=self.api_key,
|
286
294
|
verbose=verbose,
|
287
295
|
)
|
296
|
+
elif self.provider_type == VMProviderType.WINSANDBOX:
|
297
|
+
self.config.vm_provider = VMProviderFactory.create_provider(
|
298
|
+
self.provider_type,
|
299
|
+
port=port,
|
300
|
+
host=host,
|
301
|
+
storage=storage,
|
302
|
+
verbose=verbose,
|
303
|
+
ephemeral=ephemeral,
|
304
|
+
)
|
288
305
|
else:
|
289
306
|
raise ValueError(f"Unsupported provider type: {self.provider_type}")
|
290
307
|
self._provider_context = await self.config.vm_provider.__aenter__()
|
@@ -383,7 +400,6 @@ class Computer:
|
|
383
400
|
# Wait for VM to be ready with a valid IP address
|
384
401
|
self.logger.info("Waiting for VM to be ready with a valid IP address...")
|
385
402
|
try:
|
386
|
-
# Increased values for Lumier provider which needs more time for initial setup
|
387
403
|
if self.provider_type == VMProviderType.LUMIER:
|
388
404
|
max_retries = 60 # Increased for Lumier VM startup which takes longer
|
389
405
|
retry_delay = 3 # 3 seconds between retries for Lumier
|
@@ -513,7 +529,7 @@ class Computer:
|
|
513
529
|
return
|
514
530
|
|
515
531
|
# @property
|
516
|
-
async def get_ip(self, max_retries: int = 15, retry_delay: int =
|
532
|
+
async def get_ip(self, max_retries: int = 15, retry_delay: int = 3) -> str:
|
517
533
|
"""Get the IP address of the VM or localhost if using host computer server.
|
518
534
|
|
519
535
|
This method delegates to the provider's get_ip method, which waits indefinitely
|
computer/interface/factory.py
CHANGED
@@ -8,7 +8,7 @@ class InterfaceFactory:
|
|
8
8
|
|
9
9
|
@staticmethod
|
10
10
|
def create_interface_for_os(
|
11
|
-
os: Literal['macos', 'linux'],
|
11
|
+
os: Literal['macos', 'linux', 'windows'],
|
12
12
|
ip_address: str,
|
13
13
|
api_key: Optional[str] = None,
|
14
14
|
vm_name: Optional[str] = None
|
@@ -16,7 +16,7 @@ class InterfaceFactory:
|
|
16
16
|
"""Create an interface for the specified OS.
|
17
17
|
|
18
18
|
Args:
|
19
|
-
os: Operating system type ('macos' or '
|
19
|
+
os: Operating system type ('macos', 'linux', or 'windows')
|
20
20
|
ip_address: IP address of the computer to control
|
21
21
|
api_key: Optional API key for cloud authentication
|
22
22
|
vm_name: Optional VM name for cloud authentication
|
@@ -30,10 +30,13 @@ class InterfaceFactory:
|
|
30
30
|
# Import implementations here to avoid circular imports
|
31
31
|
from .macos import MacOSComputerInterface
|
32
32
|
from .linux import LinuxComputerInterface
|
33
|
+
from .windows import WindowsComputerInterface
|
33
34
|
|
34
35
|
if os == 'macos':
|
35
36
|
return MacOSComputerInterface(ip_address, api_key=api_key, vm_name=vm_name)
|
36
37
|
elif os == 'linux':
|
37
38
|
return LinuxComputerInterface(ip_address, api_key=api_key, vm_name=vm_name)
|
39
|
+
elif os == 'windows':
|
40
|
+
return WindowsComputerInterface(ip_address, api_key=api_key, vm_name=vm_name)
|
38
41
|
else:
|
39
|
-
raise ValueError(f"Unsupported OS type: {os}")
|
42
|
+
raise ValueError(f"Unsupported OS type: {os}")
|