Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

update to only use CUA_TELEMETRY_ENABLED

Sarina Li26caedf49272
diff --git a/docs/content/docs/agent-sdk/telemetry.mdx b/docs/content/docs/agent-sdk/telemetry.mdx
index c4cc6fa567..4dcb80a897 100644
--- a/docs/content/docs/agent-sdk/telemetry.mdx
+++ b/docs/content/docs/agent-sdk/telemetry.mdx
@@ -52,6 +52,12 @@ import os
os.environ["CUA_TELEMETRY_ENABLED"] = "false"
```
+<Callout type="info">
+ **Deprecated environment variables:** The environment variables `CUA_TELEMETRY` and
+ `CUA_TELEMETRY_DISABLED` are deprecated and no longer have any effect. Use `CUA_TELEMETRY_ENABLED`
+ instead.
+</Callout>
+
### Per instance
**Computer SDK:**
diff --git a/docs/tsconfig.json b/docs/tsconfig.json
index 34346f5f5f..14131e682d 100644
--- a/docs/tsconfig.json
+++ b/docs/tsconfig.json
@@ -13,7 +13,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
- "jsx": "react-jsx",
+ "jsx": "preserve",
"incremental": true,
"paths": {
"@/.source": ["./.source/index.ts"],
diff --git a/libs/python/agent/pyproject.toml b/libs/python/agent/pyproject.toml
index a8d84b05d3..8e187716e5 100644
--- a/libs/python/agent/pyproject.toml
+++ b/libs/python/agent/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "pdm.backend"
[project]
name = "cua-agent"
-version = "0.5.0"
+version = "0.5.1"
description = "CUA (Computer Use) Agent for AI-driven computer interaction"
readme = "README.md"
authors = [
diff --git a/libs/python/core/core/telemetry/posthog.py b/libs/python/core/core/telemetry/posthog.py
index 5edd734316..29f5a66198 100644
--- a/libs/python/core/core/telemetry/posthog.py
+++ b/libs/python/core/core/telemetry/posthog.py
@@ -44,13 +44,12 @@ class PostHogTelemetryClient:
@classmethod
def is_telemetry_enabled(cls) -> bool:
"""True if telemetry is currently active for this process."""
- return (
- # Legacy opt-out flag
- os.environ.get("CUA_TELEMETRY", "").lower() != "off"
- # Opt-in flag (defaults to enabled)
- and os.environ.get("CUA_TELEMETRY_ENABLED", "true").lower()
- in {"1", "true", "yes", "on"}
- )
+ return os.environ.get("CUA_TELEMETRY_ENABLED", "true").lower() in {
+ "1",
+ "true",
+ "yes",
+ "on",
+ }
def _get_or_create_installation_id(self) -> str:
"""Get or create a unique installation ID that persists across runs.
diff --git a/libs/python/core/tests/test_telemetry.py b/libs/python/core/tests/test_telemetry.py
index 5446a884e5..93f4ae3d4d 100644
--- a/libs/python/core/tests/test_telemetry.py
+++ b/libs/python/core/tests/test_telemetry.py
@@ -24,15 +24,7 @@ class TestTelemetryEnabled:
assert is_telemetry_enabled() is True
- def test_telemetry_disabled_with_legacy_flag(self, monkeypatch):
- """Test that telemetry can be disabled with legacy CUA_TELEMETRY=off."""
- monkeypatch.setenv("CUA_TELEMETRY", "off")
-
- from core.telemetry import is_telemetry_enabled
-
- assert is_telemetry_enabled() is False
-
- def test_telemetry_disabled_with_new_flag(self, monkeypatch):
+ def test_telemetry_disabled_with_flag(self, monkeypatch):
"""Test that telemetry can be disabled with CUA_TELEMETRY_ENABLED=false."""
monkeypatch.setenv("CUA_TELEMETRY_ENABLED", "false")
diff --git a/libs/typescript/core/src/telemetry/clients/posthog.ts b/libs/typescript/core/src/telemetry/clients/posthog.ts
index 7b14d162b9..260a1873e3 100644
--- a/libs/typescript/core/src/telemetry/clients/posthog.ts
+++ b/libs/typescript/core/src/telemetry/clients/posthog.ts
@@ -44,14 +44,12 @@ export class PostHogTelemetryClient {
sampleRate: TELEMETRY_SAMPLE_RATE,
posthog: { apiKey: PUBLIC_POSTHOG_API_KEY, host: PUBLIC_POSTHOG_HOST },
};
- // Check for multiple environment variables that can disable telemetry:
- // CUA_TELEMETRY=off to disable telemetry (legacy way)
- // CUA_TELEMETRY_DISABLED=1 to disable telemetry (new, more explicit way)
- const telemetryDisabled =
- process.env.CUA_TELEMETRY?.toLowerCase() === 'off' ||
- ['1', 'true', 'yes', 'on'].includes(process.env.CUA_TELEMETRY_DISABLED?.toLowerCase() || '');
-
- this.config.enabled = !telemetryDisabled;
+ // Check CUA_TELEMETRY_ENABLED environment variable (defaults to enabled)
+ const telemetryEnabled = ['1', 'true', 'yes', 'on'].includes(
+ process.env.CUA_TELEMETRY_ENABLED?.toLowerCase() || 'true'
+ );
+
+ this.config.enabled = telemetryEnabled;
this.config.sampleRate = Number.parseFloat(
process.env.CUA_TELEMETRY_SAMPLE_RATE || String(TELEMETRY_SAMPLE_RATE)
);
diff --git a/libs/typescript/core/tests/telemetry.test.ts b/libs/typescript/core/tests/telemetry.test.ts
index 4c4d47f604..7cfbec4e32 100644
--- a/libs/typescript/core/tests/telemetry.test.ts
+++ b/libs/typescript/core/tests/telemetry.test.ts
@@ -4,27 +4,38 @@ import { Telemetry } from '../src/';
describe('Telemetry', () => {
let telemetry: Telemetry;
beforeEach(() => {
- process.env.CUA_TELEMETRY = '';
- process.env.CUA_TELEMETRY_DISABLED = '';
+ process.env.CUA_TELEMETRY_ENABLED = '';
telemetry = new Telemetry();
});
describe('telemetry.enabled', () => {
- it('should return false when CUA_TELEMETRY is off', () => {
- process.env.CUA_TELEMETRY = 'off';
+ it('should return false when CUA_TELEMETRY_ENABLED is false', () => {
+ process.env.CUA_TELEMETRY_ENABLED = 'false';
telemetry = new Telemetry();
expect(telemetry.enabled).toBe(false);
});
- it('should return true when CUA_TELEMETRY is not set', () => {
- process.env.CUA_TELEMETRY = '';
+ it('should return false when CUA_TELEMETRY_ENABLED is 0', () => {
+ process.env.CUA_TELEMETRY_ENABLED = '0';
+ telemetry = new Telemetry();
+ expect(telemetry.enabled).toBe(false);
+ });
+
+ it('should return true when CUA_TELEMETRY_ENABLED is not set (default)', () => {
+ delete process.env.CUA_TELEMETRY_ENABLED;
telemetry = new Telemetry();
expect(telemetry.enabled).toBe(true);
});
- it('should return false if CUA_TELEMETRY_DISABLED is 1', () => {
- process.env.CUA_TELEMETRY_DISABLED = '1';
+ it('should return true when CUA_TELEMETRY_ENABLED is true', () => {
+ process.env.CUA_TELEMETRY_ENABLED = 'true';
telemetry = new Telemetry();
- expect(telemetry.enabled).toBe(false);
+ expect(telemetry.enabled).toBe(true);
+ });
+
+ it('should return true when CUA_TELEMETRY_ENABLED is 1', () => {
+ process.env.CUA_TELEMETRY_ENABLED = '1';
+ telemetry = new Telemetry();
+ expect(telemetry.enabled).toBe(true);
});
});
});