droidrun 0.3.1__py3-none-any.whl → 0.3.3__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.
- droidrun/__init__.py +7 -12
- droidrun/agent/codeact/codeact_agent.py +9 -7
- droidrun/agent/common/events.py +44 -1
- droidrun/agent/context/personas/__init__.py +2 -2
- droidrun/agent/context/personas/big_agent.py +96 -0
- droidrun/agent/context/personas/ui_expert.py +1 -0
- droidrun/agent/droid/droid_agent.py +63 -11
- droidrun/agent/droid/events.py +4 -0
- droidrun/agent/planner/planner_agent.py +2 -2
- droidrun/agent/utils/executer.py +10 -2
- droidrun/agent/utils/llm_picker.py +1 -0
- droidrun/agent/utils/trajectory.py +258 -11
- droidrun/cli/main.py +179 -86
- droidrun/macro/__init__.py +14 -0
- droidrun/macro/__main__.py +10 -0
- droidrun/macro/cli.py +228 -0
- droidrun/macro/replay.py +309 -0
- droidrun/portal.py +138 -0
- droidrun/telemetry/__init__.py +4 -0
- droidrun/telemetry/events.py +27 -0
- droidrun/telemetry/tracker.py +84 -0
- droidrun/tools/adb.py +704 -372
- droidrun/tools/ios.py +169 -166
- droidrun/tools/tools.py +70 -17
- {droidrun-0.3.1.dist-info → droidrun-0.3.3.dist-info}/METADATA +31 -29
- droidrun-0.3.3.dist-info/RECORD +54 -0
- droidrun/adb/__init__.py +0 -13
- droidrun/adb/device.py +0 -315
- droidrun/adb/manager.py +0 -93
- droidrun/adb/wrapper.py +0 -226
- droidrun/agent/context/personas/extractor.py +0 -52
- droidrun-0.3.1.dist-info/RECORD +0 -50
- {droidrun-0.3.1.dist-info → droidrun-0.3.3.dist-info}/WHEEL +0 -0
- {droidrun-0.3.1.dist-info → droidrun-0.3.3.dist-info}/entry_points.txt +0 -0
- {droidrun-0.3.1.dist-info → droidrun-0.3.3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
from typing import List
|
2
|
+
from droidrun.agent.context import Task
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
class TelemetryEvent(BaseModel):
|
6
|
+
pass
|
7
|
+
|
8
|
+
class DroidAgentInitEvent(TelemetryEvent):
|
9
|
+
goal: str
|
10
|
+
llm: str
|
11
|
+
tools: str
|
12
|
+
personas: str
|
13
|
+
max_steps: int
|
14
|
+
timeout: int
|
15
|
+
vision: bool
|
16
|
+
reasoning: bool
|
17
|
+
reflection: bool
|
18
|
+
enable_tracing: bool
|
19
|
+
debug: bool
|
20
|
+
save_trajectories: bool
|
21
|
+
|
22
|
+
|
23
|
+
class DroidAgentFinalizeEvent(TelemetryEvent):
|
24
|
+
tasks: str
|
25
|
+
success: bool
|
26
|
+
output: str
|
27
|
+
steps: int
|
@@ -0,0 +1,84 @@
|
|
1
|
+
from posthog import Posthog
|
2
|
+
from pathlib import Path
|
3
|
+
from uuid import uuid4
|
4
|
+
import os
|
5
|
+
import logging
|
6
|
+
from .events import TelemetryEvent
|
7
|
+
|
8
|
+
logger = logging.getLogger("droidrun-telemetry")
|
9
|
+
droidrun_logger = logging.getLogger("droidrun")
|
10
|
+
|
11
|
+
PROJECT_API_KEY = "phc_XyD3HKIsetZeRkmnfaBughs8fXWYArSUFc30C0HmRiO"
|
12
|
+
HOST = "https://eu.i.posthog.com"
|
13
|
+
USER_ID_PATH = Path.home() / ".droidrun" / "user_id"
|
14
|
+
RUN_ID = str(uuid4())
|
15
|
+
|
16
|
+
TELEMETRY_ENABLED_MESSAGE = "🕵️ Anonymized telemetry enabled. See https://docs.droidrun.ai/v3/guides/telemetry for more information."
|
17
|
+
TELEMETRY_DISABLED_MESSAGE = "🛑 Anonymized telemetry disabled. Consider setting the DROIDRUN_TELEMETRY_ENABLED environment variable to 'true' to enable telemetry and help us improve DroidRun."
|
18
|
+
|
19
|
+
posthog = Posthog(
|
20
|
+
project_api_key=PROJECT_API_KEY,
|
21
|
+
host=HOST,
|
22
|
+
disable_geoip=False,
|
23
|
+
)
|
24
|
+
|
25
|
+
|
26
|
+
def is_telemetry_enabled():
|
27
|
+
telemetry_enabled = os.environ.get("DROIDRUN_TELEMETRY_ENABLED", "true")
|
28
|
+
enabled = telemetry_enabled.lower() in ["true", "1", "yes", "y"]
|
29
|
+
logger.debug(f"Telemetry enabled: {enabled}")
|
30
|
+
return enabled
|
31
|
+
|
32
|
+
|
33
|
+
def print_telemetry_message():
|
34
|
+
if is_telemetry_enabled():
|
35
|
+
droidrun_logger.info(TELEMETRY_ENABLED_MESSAGE)
|
36
|
+
|
37
|
+
else:
|
38
|
+
droidrun_logger.info(TELEMETRY_DISABLED_MESSAGE)
|
39
|
+
|
40
|
+
|
41
|
+
# Print telemetry message on import
|
42
|
+
print_telemetry_message()
|
43
|
+
|
44
|
+
|
45
|
+
def get_user_id() -> str:
|
46
|
+
try:
|
47
|
+
if not USER_ID_PATH.exists():
|
48
|
+
USER_ID_PATH.parent.mkdir(parents=True, exist_ok=True)
|
49
|
+
USER_ID_PATH.touch()
|
50
|
+
USER_ID_PATH.write_text(str(uuid4()))
|
51
|
+
logger.debug(f"User ID: {USER_ID_PATH.read_text()}")
|
52
|
+
return USER_ID_PATH.read_text()
|
53
|
+
except Exception as e:
|
54
|
+
logger.error(f"Error getting user ID: {e}")
|
55
|
+
return "unknown"
|
56
|
+
|
57
|
+
|
58
|
+
def capture(event: TelemetryEvent, user_id: str | None = None):
|
59
|
+
try:
|
60
|
+
if not is_telemetry_enabled():
|
61
|
+
logger.debug(f"Telemetry disabled, skipping capture of {event}")
|
62
|
+
return
|
63
|
+
event_name = type(event).__name__
|
64
|
+
event_data = event.model_dump()
|
65
|
+
properties = {
|
66
|
+
"run_id": RUN_ID,
|
67
|
+
**event_data,
|
68
|
+
}
|
69
|
+
|
70
|
+
posthog.capture(event_name, distinct_id=user_id or get_user_id(), properties=properties)
|
71
|
+
logger.debug(f"Captured event: {event_name} with properties: {event}")
|
72
|
+
except Exception as e:
|
73
|
+
logger.error(f"Error capturing event: {e}")
|
74
|
+
|
75
|
+
|
76
|
+
def flush():
|
77
|
+
try:
|
78
|
+
if not is_telemetry_enabled():
|
79
|
+
logger.debug(f"Telemetry disabled, skipping flush")
|
80
|
+
return
|
81
|
+
posthog.flush()
|
82
|
+
logger.debug(f"Flushed telemetry data")
|
83
|
+
except Exception as e:
|
84
|
+
logger.error(f"Error flushing telemetry data: {e}")
|