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/adb/wrapper.py DELETED
@@ -1,226 +0,0 @@
1
- """
2
- ADB Wrapper - Lightweight wrapper around ADB for Android device control.
3
- """
4
-
5
- import asyncio
6
- import os
7
- import shlex
8
- from typing import Dict, List, Optional, Tuple
9
-
10
- class ADBWrapper:
11
- """Lightweight wrapper around ADB for Android device control."""
12
-
13
- def __init__(self, adb_path: Optional[str] = None):
14
- """Initialize ADB wrapper.
15
-
16
- Args:
17
- adb_path: Path to ADB binary (defaults to 'adb' in PATH)
18
- """
19
- self.adb_path = adb_path or "adb"
20
- self._devices_cache: List[Dict[str, str]] = []
21
-
22
- async def _run_command(
23
- self,
24
- args: List[str],
25
- timeout: Optional[float] = None,
26
- check: bool = True
27
- ) -> Tuple[str, str]:
28
- """Run an ADB command.
29
-
30
- Args:
31
- args: Command arguments
32
- timeout: Command timeout in seconds
33
- check: Whether to check return code
34
-
35
- Returns:
36
- Tuple of (stdout, stderr)
37
- """
38
- cmd = [self.adb_path, *args]
39
-
40
- try:
41
- process = await asyncio.create_subprocess_exec(
42
- *cmd,
43
- stdout=asyncio.subprocess.PIPE,
44
- stderr=asyncio.subprocess.PIPE,
45
- )
46
-
47
- if timeout is not None:
48
- stdout_bytes, stderr_bytes = await asyncio.wait_for(
49
- process.communicate(), timeout
50
- )
51
- else:
52
- stdout_bytes, stderr_bytes = await process.communicate()
53
-
54
- stdout = stdout_bytes.decode("utf-8", errors="replace").strip()
55
- stderr = stderr_bytes.decode("utf-8", errors="replace").strip()
56
-
57
- if check and process.returncode != 0:
58
- raise RuntimeError(f"ADB command failed: {stderr or stdout}")
59
-
60
- return stdout, stderr
61
-
62
- except asyncio.TimeoutError:
63
- raise TimeoutError(f"ADB command timed out: {' '.join(cmd)}")
64
- except FileNotFoundError:
65
- raise FileNotFoundError(f"ADB not found at {self.adb_path}")
66
-
67
- async def _run_device_command(
68
- self,
69
- serial: str,
70
- args: List[str],
71
- timeout: Optional[float] = None,
72
- check: bool = True
73
- ) -> Tuple[str, str]:
74
- """Run an ADB command for a specific device."""
75
- return await self._run_command(["-s", serial, *args], timeout, check)
76
-
77
- async def get_devices(self) -> List[Dict[str, str]]:
78
- """Get list of connected devices.
79
-
80
- Returns:
81
- List of device info dictionaries with 'serial' and 'status' keys
82
- """
83
- stdout, _ = await self._run_command(["devices", "-l"])
84
-
85
- devices = []
86
- for line in stdout.splitlines()[1:]: # Skip first line (header)
87
- if not line.strip():
88
- continue
89
-
90
- parts = line.split()
91
- if not parts:
92
- continue
93
-
94
- serial = parts[0]
95
- status = parts[1] if len(parts) > 1 else "unknown"
96
-
97
- devices.append({
98
- "serial": serial,
99
- "status": status
100
- })
101
-
102
- self._devices_cache = devices
103
- return devices
104
-
105
- async def connect(self, host: str, port: int = 5555) -> str:
106
- """Connect to a device over TCP/IP.
107
-
108
- Args:
109
- host: Device IP address
110
- port: Device port
111
-
112
- Returns:
113
- Device serial number (host:port)
114
- """
115
- serial = f"{host}:{port}"
116
-
117
- # Check if already connected
118
- devices = await self.get_devices()
119
- if any(d["serial"] == serial for d in devices):
120
- return serial
121
-
122
- stdout, _ = await self._run_command(["connect", serial], timeout=10.0)
123
-
124
- if "connected" not in stdout.lower():
125
- raise RuntimeError(f"Failed to connect: {stdout}")
126
-
127
- return serial
128
-
129
- async def disconnect(self, serial: str) -> bool:
130
- """Disconnect from a device.
131
-
132
- Args:
133
- serial: Device serial number
134
-
135
- Returns:
136
- True if disconnected successfully
137
- """
138
- try:
139
- stdout, _ = await self._run_command(["disconnect", serial])
140
- return "disconnected" in stdout.lower()
141
- except Exception:
142
- return False
143
-
144
- async def shell(self, serial: str, command: str, timeout: Optional[float] = None) -> str:
145
- """Run a shell command on the device.
146
-
147
- Args:
148
- serial: Device serial number
149
- command: Shell command to run
150
- timeout: Command timeout in seconds
151
-
152
- Returns:
153
- Command output
154
- """
155
- stdout, _ = await self._run_device_command(serial, ["shell", command], timeout=timeout)
156
- return stdout
157
-
158
- async def get_properties(self, serial: str) -> Dict[str, str]:
159
- """Get device properties.
160
-
161
- Args:
162
- serial: Device serial number
163
-
164
- Returns:
165
- Dictionary of device properties
166
- """
167
- output = await self.shell(serial, "getprop")
168
-
169
- properties = {}
170
- for line in output.splitlines():
171
- if not line or "[" not in line or "]" not in line:
172
- continue
173
-
174
- try:
175
- key = line.split("[")[1].split("]")[0]
176
- value = line.split("[")[2].split("]")[0]
177
- properties[key] = value
178
- except IndexError:
179
- continue
180
-
181
- return properties
182
-
183
- async def install_app(
184
- self,
185
- serial: str,
186
- apk_path: str,
187
- reinstall: bool = False,
188
- grant_permissions: bool = True
189
- ) -> Tuple[str, str]:
190
- """Install an APK on the device.
191
-
192
- Args:
193
- serial: Device serial number
194
- apk_path: Path to the APK file
195
- reinstall: Whether to reinstall if app exists
196
- grant_permissions: Whether to grant all permissions
197
-
198
- Returns:
199
- Tuple of (stdout, stderr)
200
- """
201
- args = ["install"]
202
- if reinstall:
203
- args.append("-r")
204
- if grant_permissions:
205
- args.append("-g")
206
- args.append(apk_path)
207
-
208
- return await self._run_device_command(serial, args, timeout=120.0)
209
-
210
- async def pull_file(self, serial: str, device_path: str, local_path: str) -> Tuple[str, str]:
211
- """Pull a file from the device.
212
-
213
- Args:
214
- serial: Device serial number
215
- device_path: Path on the device
216
- local_path: Path on the local machine
217
-
218
- Returns:
219
- Tuple of (stdout, stderr)
220
- """
221
- # Create directory if it doesn't exist
222
- local_dir = os.path.dirname(local_path)
223
- if local_dir and not os.path.exists(local_dir):
224
- os.makedirs(local_dir)
225
-
226
- return await self._run_device_command(serial, ["pull", device_path, local_path], timeout=60.0)
@@ -1,52 +0,0 @@
1
- from droidrun.agent.context.agent_persona import AgentPersona
2
- from droidrun.tools import Tools
3
-
4
- EXTRACTOR = AgentPersona(
5
- name="DataExtractor",
6
- description="Specialized in extracting data from UI elements and screenshots",
7
- expertise_areas=[
8
- "data extraction",
9
- "UI analysis",
10
- "text recognition"
11
- ],
12
- allowed_tools=[
13
- Tools.extract.__name__,
14
- Tools.complete.__name__
15
- ],
16
- required_context=[
17
- "ui_state",
18
- "screenshot"
19
- ],
20
- user_prompt="""
21
- **Current Request:**
22
- {goal}
23
- **What data needs to be extracted?
24
- Analyze the current UI state and screenshot, then extract the requested information.
25
- ** Explain your thought process then provide code in ```python ... ``` tags if needed.""",
26
-
27
- system_prompt= """
28
- You are a Data Extractor Expert specialized in analyzing Android UI states and screenshots to extract specific information. Your core expertise includes:
29
-
30
- **Primary Capabilities:**
31
- - Analyze UI elements from ui_state data
32
- - Extract text, values, and structured data from screenshots
33
- - Identify and parse specific UI components (buttons, text fields, lists, etc.)
34
- - Extract data based on user requirements
35
-
36
- ## Response Format:
37
- Example of proper code format:
38
- To extract the current battery percentage from the status bar:
39
- ```python
40
- # Extract battery percentage from UI state
41
- battery_data = extract("battery percentage")
42
- complete(success=True)
43
- ```
44
-
45
- In addition to the Python Standard Library and any functions you have already written, you can use the following functions:
46
- {tool_descriptions}
47
-
48
- Reminder: Always place your Python code between ```...``` tags when you want to run code.
49
-
50
- You focus ONLY on data extraction from the current UI state and screenshot - navigation and UI interactions are handled by other specialists.""",
51
-
52
- )
@@ -1,50 +0,0 @@
1
- droidrun/__init__.py,sha256=ERliGcmgGJpyTs7SukYD28tgRccxn6hPG8JPsH0ezZA,840
2
- droidrun/__main__.py,sha256=78o1Wr_Z-NrZy9yLWmEfNfRRhAiJGBr4Xi3lmbgkx3w,105
3
- droidrun/adb/__init__.py,sha256=kh-iT9Sv6RZ2dFSDu1beK_GgtAq8wlMvZQ7puR8JWsI,257
4
- droidrun/adb/device.py,sha256=fAKXR5Qmqzz7q3KD2VCcW6dG3NsDLfG9zd56B5kswL4,11004
5
- droidrun/adb/manager.py,sha256=g7TuEOCnMTavHzCMtr3u6TPBhmZwE98CW9vBwdhdyyg,2728
6
- droidrun/adb/wrapper.py,sha256=Yz3_JSIidq-5bf-t0UfawTutMaLrINS_1Y15m_Uss4g,7093
7
- droidrun/agent/__init__.py,sha256=4SqTJeGDvr_wT8rtN9J8hnN6P-pae663mkYr-JmzH4w,208
8
- droidrun/agent/codeact/__init__.py,sha256=ZLDGT_lTTzyNm7pcBzdyRIGHJ2ZgbInJdhXZRbJLhSQ,278
9
- droidrun/agent/codeact/codeact_agent.py,sha256=z0c10d1vk2PBciYbHLwnYlEopvwZzJhXkXqjJuUI0v4,16045
10
- droidrun/agent/codeact/events.py,sha256=skCfZ-5SR0YhhzZVxx8_VkUjfILk8rCv47k9pHNYhdc,634
11
- droidrun/agent/codeact/prompts.py,sha256=28HflWMNkC1ky0hGCzAxhJftjU2IIU1ZRUfya3S7M6I,1006
12
- droidrun/agent/common/default.py,sha256=P07el-PrHsoqQMYsYxSSln6mFl-QY75vzwp1Dll_XmY,259
13
- droidrun/agent/common/events.py,sha256=axauKdrXFEeB1hpd0geazwBtJySnHsvLZV0u9F9OWZI,96
14
- droidrun/agent/context/__init__.py,sha256=upSJilVQUwQYWJuGr_8QrmJaReV3SNAc_Z61wQZzbK4,697
15
- droidrun/agent/context/agent_persona.py,sha256=Mxd4HTyirWD-aqNlka1hQBdS-0I-lXJr2AjPMwDMUo8,390
16
- droidrun/agent/context/context_injection_manager.py,sha256=sA33q2KPtX_4Yap8wM11T6ewlZC_0FIbKPEc400SHrE,2188
17
- droidrun/agent/context/episodic_memory.py,sha256=1ImeR3jAWOpKwkQt3bMlXVOBiQbIli5fBIlBq2waREQ,394
18
- droidrun/agent/context/reflection.py,sha256=0hJluOz0hTlHHhReKpIJ9HU5aJbaJsvrjMfraQ84D-M,652
19
- droidrun/agent/context/task_manager.py,sha256=ESLs4kR6VNYiYQsc4V7WAeoSLwbaZPSWBXpveOfOv8c,4343
20
- droidrun/agent/context/personas/__init__.py,sha256=tUDIM_9Kim3ki6ZXpwcvPHPSa2cCHNMLdNW4lyJr4gM,231
21
- droidrun/agent/context/personas/app_starter.py,sha256=dHeknznxGEPJ7S6VPyEG_MB-HvAvQwUOnRWaShaV8Xo,1585
22
- droidrun/agent/context/personas/default.py,sha256=Xm07YCWoKjvlHAbQRtzE3vn7BVcz6wYcSVeg4FiojJQ,5060
23
- droidrun/agent/context/personas/extractor.py,sha256=S7Qgh3-Kz_OowQJFJGQUlr8OUVktX5UHVdf5qkAj3GQ,1907
24
- droidrun/agent/context/personas/ui_expert.py,sha256=P2dAnkKiR3O4bN4ZUuWHmuu4Qo8WRiH1mU6EEOr3yJA,4710
25
- droidrun/agent/droid/__init__.py,sha256=3BfUVZiUQ8ATAJ_JmqQZQx53WoERRpQ4AyHW5WOgbRI,297
26
- droidrun/agent/droid/droid_agent.py,sha256=ELPQOpRYQcnB64rLOoVPk12GHuQ_EFs7fMH-7t0LeQM,13365
27
- droidrun/agent/droid/events.py,sha256=bpUhJnbaIH86r8hfUsbHub465v-xYOsIyHWNN8g4TCs,576
28
- droidrun/agent/oneflows/reflector.py,sha256=I_tE0PBjvwWbS6SA8Qd41etxJglFgn8oScuKUxc9LEE,11621
29
- droidrun/agent/planner/__init__.py,sha256=Fu0Ewtd-dIRLgHIL1DB_9EEKvQS_f1vjB8jgO5TbJXg,364
30
- droidrun/agent/planner/events.py,sha256=oyt2FNrA2uVyUeVT65-N0AC6sWBFxSnwNEqWtnRYoFM,390
31
- droidrun/agent/planner/planner_agent.py,sha256=vcZx8tawMss0F2nt-4QEtdF7kSaikUq3rdWPdTNicjk,10494
32
- droidrun/agent/planner/prompts.py,sha256=Ci7Oeu3J4TAhx-tKGPZ9l6Wb3a81FSqC8cWW4jW73HI,6046
33
- droidrun/agent/utils/__init__.py,sha256=JK6ygRjw7gzcQSG0HBEYLoVGH54QQAxJJ7HpIS5mgyc,44
34
- droidrun/agent/utils/async_utils.py,sha256=IQBcWPwevm89B7R_UdMXk0unWeNCBA232b5kQGqoxNI,336
35
- droidrun/agent/utils/chat_utils.py,sha256=5oqP2nmKs8sHWP1H_TK82yaxrxWf7FdEbFKASKpR60g,13000
36
- droidrun/agent/utils/executer.py,sha256=lQbk2TbPyl_F0k2FqEVimq8cQRcWM_KCO_I7fnkkxqA,4587
37
- droidrun/agent/utils/llm_picker.py,sha256=adktsU2-GhYzZ0djOhO_TyFhUE8aGirzJy36A_EvnXU,5919
38
- droidrun/agent/utils/trajectory.py,sha256=OmO8TvNO0LVtPXg2qTCv8o9ePaMeDyf-MRWN_YObXho,6845
39
- droidrun/cli/__init__.py,sha256=DuwSRtZ8WILPd-nf-fZ7BaBsRgtofoInOF3JtJ9wag0,167
40
- droidrun/cli/logs.py,sha256=PsT_VbnOa_sOLXK4KkEJk4AsYCpscqrVoryMmLVwPG0,9714
41
- droidrun/cli/main.py,sha256=3VP5cZ0a7bKcNnqwMQ8mBvaprPcjgM7394WBRdkKDKU,15059
42
- droidrun/tools/__init__.py,sha256=9ReauavtSKDQG9ya9_Fr9O0TQnDFixgOPaP5n82_iEk,271
43
- droidrun/tools/adb.py,sha256=1Nv8tkmgqGlOZJYe39W5SGwdqnEjrxN7szsLQ_BkWqo,30137
44
- droidrun/tools/ios.py,sha256=-fq4VNJFVTkR4xtUW9IVyUXwqnhsJWda_fik3II2EGg,22885
45
- droidrun/tools/tools.py,sha256=EH3hzrVUHEkTUT-PF2s9NHyNntV9xoNXskmNBcZwLm4,2385
46
- droidrun-0.3.1.dist-info/METADATA,sha256=8lZqTnD2aoQOcpRKn6TL7rC0IdshMhAUAnyY9QWCKmQ,6344
47
- droidrun-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
48
- droidrun-0.3.1.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
49
- droidrun-0.3.1.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
50
- droidrun-0.3.1.dist-info/RECORD,,