cua-computer 0.4.3__tar.gz → 0.4.4__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.
- {cua_computer-0.4.3 → cua_computer-0.4.4}/PKG-INFO +1 -1
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/__init__.py +0 -4
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/computer.py +13 -3
- {cua_computer-0.4.3 → cua_computer-0.4.4}/pyproject.toml +3 -3
- cua_computer-0.4.3/computer/telemetry.py +0 -116
- {cua_computer-0.4.3 → cua_computer-0.4.4}/README.md +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/diorama_computer.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/helpers.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/base.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/factory.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/generic.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/linux.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/macos.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/models.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/interface/windows.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/logger.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/models.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/base.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/cloud/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/cloud/provider.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/docker/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/docker/provider.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/factory.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/lume/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/lume/provider.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/lume_api.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/lumier/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/lumier/provider.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/winsandbox/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/winsandbox/provider.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/providers/winsandbox/setup_script.ps1 +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/ui/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/ui/__main__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/ui/gradio/__init__.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/ui/gradio/app.py +0 -0
- {cua_computer-0.4.3 → cua_computer-0.4.4}/computer/utils.py +0 -0
@@ -12,7 +12,6 @@ logger = logging.getLogger("computer")
|
|
12
12
|
try:
|
13
13
|
# Import from core telemetry
|
14
14
|
from core.telemetry import (
|
15
|
-
flush,
|
16
15
|
is_telemetry_enabled,
|
17
16
|
record_event,
|
18
17
|
)
|
@@ -30,9 +29,6 @@ try:
|
|
30
29
|
"python_version": sys.version,
|
31
30
|
},
|
32
31
|
)
|
33
|
-
|
34
|
-
# Flush events to ensure they're sent
|
35
|
-
flush()
|
36
32
|
else:
|
37
33
|
logger.info("Telemetry is disabled")
|
38
34
|
except ImportError as e:
|
@@ -9,10 +9,18 @@ import re
|
|
9
9
|
from .logger import Logger, LogLevel
|
10
10
|
import json
|
11
11
|
import logging
|
12
|
-
from .telemetry import
|
12
|
+
from core.telemetry import is_telemetry_enabled, record_event
|
13
13
|
import os
|
14
14
|
from . import helpers
|
15
15
|
|
16
|
+
import platform
|
17
|
+
|
18
|
+
SYSTEM_INFO = {
|
19
|
+
"os": platform.system().lower(),
|
20
|
+
"os_version": platform.release(),
|
21
|
+
"python_version": platform.python_version(),
|
22
|
+
}
|
23
|
+
|
16
24
|
# Import provider related modules
|
17
25
|
from .providers.base import VMProviderType
|
18
26
|
from .providers.factory import VMProviderFactory
|
@@ -152,6 +160,8 @@ class Computer:
|
|
152
160
|
if not name:
|
153
161
|
# Normalize the name to be used for the VM
|
154
162
|
name = image.replace(":", "_")
|
163
|
+
# Remove any forward slashes
|
164
|
+
name = name.replace("/", "_")
|
155
165
|
|
156
166
|
# Convert display parameter to Display object
|
157
167
|
if isinstance(display, str):
|
@@ -190,8 +200,8 @@ class Computer:
|
|
190
200
|
self.use_host_computer_server = use_host_computer_server
|
191
201
|
|
192
202
|
# Record initialization in telemetry (if enabled)
|
193
|
-
if telemetry_enabled:
|
194
|
-
|
203
|
+
if telemetry_enabled and is_telemetry_enabled():
|
204
|
+
record_event("computer_initialized", SYSTEM_INFO)
|
195
205
|
else:
|
196
206
|
self.logger.debug("Telemetry disabled - skipping initialization tracking")
|
197
207
|
|
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
|
|
6
6
|
|
7
7
|
[project]
|
8
8
|
name = "cua-computer"
|
9
|
-
version = "0.4.
|
9
|
+
version = "0.4.4"
|
10
10
|
description = "Computer-Use Interface (CUI) framework powering Cua"
|
11
11
|
readme = "README.md"
|
12
12
|
authors = [
|
@@ -57,7 +57,7 @@ target-version = [
|
|
57
57
|
|
58
58
|
[tool.ruff]
|
59
59
|
line-length = 100
|
60
|
-
target-version = "0.4.
|
60
|
+
target-version = "0.4.4"
|
61
61
|
select = [
|
62
62
|
"E",
|
63
63
|
"F",
|
@@ -71,7 +71,7 @@ docstring-code-format = true
|
|
71
71
|
|
72
72
|
[tool.mypy]
|
73
73
|
strict = true
|
74
|
-
python_version = "0.4.
|
74
|
+
python_version = "0.4.4"
|
75
75
|
ignore_missing_imports = true
|
76
76
|
disallow_untyped_defs = true
|
77
77
|
check_untyped_defs = true
|
@@ -1,116 +0,0 @@
|
|
1
|
-
"""Computer telemetry for tracking anonymous usage and feature usage."""
|
2
|
-
|
3
|
-
import logging
|
4
|
-
import platform
|
5
|
-
from typing import Any
|
6
|
-
|
7
|
-
# Import the core telemetry module
|
8
|
-
TELEMETRY_AVAILABLE = False
|
9
|
-
|
10
|
-
try:
|
11
|
-
from core.telemetry import (
|
12
|
-
increment,
|
13
|
-
is_telemetry_enabled,
|
14
|
-
is_telemetry_globally_disabled,
|
15
|
-
record_event,
|
16
|
-
)
|
17
|
-
|
18
|
-
def increment_counter(counter_name: str, value: int = 1) -> None:
|
19
|
-
"""Wrapper for increment to maintain backward compatibility."""
|
20
|
-
if is_telemetry_enabled():
|
21
|
-
increment(counter_name, value)
|
22
|
-
|
23
|
-
def set_dimension(name: str, value: Any) -> None:
|
24
|
-
"""Set a dimension that will be attached to all events."""
|
25
|
-
logger = logging.getLogger("computer.telemetry")
|
26
|
-
logger.debug(f"Setting dimension {name}={value}")
|
27
|
-
|
28
|
-
TELEMETRY_AVAILABLE = True
|
29
|
-
logger = logging.getLogger("computer.telemetry")
|
30
|
-
logger.info("Successfully imported telemetry")
|
31
|
-
except ImportError as e:
|
32
|
-
logger = logging.getLogger("computer.telemetry")
|
33
|
-
logger.warning(f"Could not import telemetry: {e}")
|
34
|
-
TELEMETRY_AVAILABLE = False
|
35
|
-
|
36
|
-
|
37
|
-
# Local fallbacks in case core telemetry isn't available
|
38
|
-
def _noop(*args: Any, **kwargs: Any) -> None:
|
39
|
-
"""No-op function for when telemetry is not available."""
|
40
|
-
pass
|
41
|
-
|
42
|
-
|
43
|
-
logger = logging.getLogger("computer.telemetry")
|
44
|
-
|
45
|
-
# If telemetry isn't available, use no-op functions
|
46
|
-
if not TELEMETRY_AVAILABLE:
|
47
|
-
logger.debug("Telemetry not available, using no-op functions")
|
48
|
-
record_event = _noop # type: ignore
|
49
|
-
increment_counter = _noop # type: ignore
|
50
|
-
set_dimension = _noop # type: ignore
|
51
|
-
get_telemetry_client = lambda: None # type: ignore
|
52
|
-
flush = _noop # type: ignore
|
53
|
-
is_telemetry_enabled = lambda: False # type: ignore
|
54
|
-
is_telemetry_globally_disabled = lambda: True # type: ignore
|
55
|
-
|
56
|
-
# Get system info once to use in telemetry
|
57
|
-
SYSTEM_INFO = {
|
58
|
-
"os": platform.system().lower(),
|
59
|
-
"os_version": platform.release(),
|
60
|
-
"python_version": platform.python_version(),
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
def enable_telemetry() -> bool:
|
65
|
-
"""Enable telemetry if available.
|
66
|
-
|
67
|
-
Returns:
|
68
|
-
bool: True if telemetry was successfully enabled, False otherwise
|
69
|
-
"""
|
70
|
-
global TELEMETRY_AVAILABLE
|
71
|
-
|
72
|
-
# Check if globally disabled using core function
|
73
|
-
if TELEMETRY_AVAILABLE and is_telemetry_globally_disabled():
|
74
|
-
logger.info("Telemetry is globally disabled via environment variable - cannot enable")
|
75
|
-
return False
|
76
|
-
|
77
|
-
# Already enabled
|
78
|
-
if TELEMETRY_AVAILABLE:
|
79
|
-
return True
|
80
|
-
|
81
|
-
# Try to import and enable
|
82
|
-
try:
|
83
|
-
# Verify we can import core telemetry
|
84
|
-
from core.telemetry import record_event # type: ignore
|
85
|
-
|
86
|
-
TELEMETRY_AVAILABLE = True
|
87
|
-
logger.info("Telemetry successfully enabled")
|
88
|
-
return True
|
89
|
-
except ImportError as e:
|
90
|
-
logger.warning(f"Could not enable telemetry: {e}")
|
91
|
-
return False
|
92
|
-
|
93
|
-
|
94
|
-
def is_telemetry_enabled() -> bool:
|
95
|
-
"""Check if telemetry is enabled.
|
96
|
-
|
97
|
-
Returns:
|
98
|
-
bool: True if telemetry is enabled, False otherwise
|
99
|
-
"""
|
100
|
-
# Use the core function if available, otherwise use our local flag
|
101
|
-
if TELEMETRY_AVAILABLE:
|
102
|
-
from core.telemetry import is_telemetry_enabled as core_is_enabled
|
103
|
-
|
104
|
-
return core_is_enabled()
|
105
|
-
return False
|
106
|
-
|
107
|
-
|
108
|
-
def record_computer_initialization() -> None:
|
109
|
-
"""Record when a computer instance is initialized."""
|
110
|
-
if TELEMETRY_AVAILABLE and is_telemetry_enabled():
|
111
|
-
record_event("computer_initialized", SYSTEM_INFO)
|
112
|
-
|
113
|
-
# Set dimensions that will be attached to all events
|
114
|
-
set_dimension("os", SYSTEM_INFO["os"])
|
115
|
-
set_dimension("os_version", SYSTEM_INFO["os_version"])
|
116
|
-
set_dimension("python_version", SYSTEM_INFO["python_version"])
|
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
|
File without changes
|
File without changes
|
File without changes
|