droidrun 0.3.4__py3-none-any.whl → 0.3.5__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.
@@ -43,6 +43,13 @@ class TaskManager:
43
43
  def get_task_history(self):
44
44
  return self.task_history
45
45
 
46
+ def get_current_task(self) -> Optional[Task]:
47
+ """Return the first task with status "pending" from the task list."""
48
+ for task in self.tasks:
49
+ if task.status == self.STATUS_PENDING:
50
+ return task
51
+ return None
52
+
46
53
  def complete_task(self, task: Task, message: Optional[str] = None):
47
54
  task = copy.deepcopy(task)
48
55
  task.status = self.STATUS_COMPLETED
@@ -60,6 +67,9 @@ class TaskManager:
60
67
 
61
68
  def get_failed_tasks(self) -> list[dict]:
62
69
  return [task for task in self.task_history if task.status == self.STATUS_FAILED]
70
+
71
+ def get_task_history(self) -> list[dict]:
72
+ return self.task_history
63
73
 
64
74
 
65
75
  def save_to_file(self):
@@ -259,8 +259,9 @@ wrap your code inside this:
259
259
 
260
260
 
261
261
  chat_history = await chat_utils.add_task_history_block(
262
- self.task_manager.get_completed_tasks(),
263
- self.task_manager.get_failed_tasks(),
262
+ #self.task_manager.get_completed_tasks(),
263
+ #self.task_manager.get_failed_tasks(),
264
+ self.task_manager.get_task_history(),
264
265
  chat_history,
265
266
  )
266
267
 
@@ -120,7 +120,7 @@ async def add_ui_text_block(ui_state: str, chat_history: List[ChatMessage], copy
120
120
 
121
121
  async def add_screenshot_image_block(screenshot, chat_history: List[ChatMessage], copy = True) -> None:
122
122
  if screenshot:
123
- image_block = ImageBlock(image=base64.b64encode(screenshot))
123
+ image_block = ImageBlock(image=screenshot)
124
124
  if copy:
125
125
  chat_history = chat_history.copy() # Create a copy of chat history to avoid modifying the original
126
126
  chat_history[-1] = message_copy(chat_history[-1])
@@ -201,29 +201,31 @@ async def get_reflection_block(reflections: List[Reflection]) -> ChatMessage:
201
201
 
202
202
  return ChatMessage(role="user", content=reflection_block)
203
203
 
204
- async def add_task_history_block(completed_tasks: list[dict], failed_tasks: list[dict], chat_history: List[ChatMessage]) -> List[ChatMessage]:
205
- task_history = ""
204
+ async def add_task_history_block(all_tasks: list[dict], chat_history: List[ChatMessage]) -> List[ChatMessage]:
205
+ """Experimental task history with all previous tasks."""
206
+ if not all_tasks:
207
+ return chat_history
208
+
209
+ lines = ["### Task Execution History (chronological):"]
210
+ for index, task in enumerate(all_tasks, 1):
211
+ description: str
212
+ status_value: str
213
+
214
+ if hasattr(task, "description") and hasattr(task, "status"):
215
+ description = getattr(task, "description")
216
+ status_value = getattr(task, "status") or "unknown"
217
+ elif isinstance(task, dict):
218
+ description = str(task.get("description", task))
219
+ status_value = str(task.get("status", "unknown"))
220
+ else:
221
+ description = str(task)
222
+ status_value = "unknown"
206
223
 
207
- # Combine all tasks and show in chronological order
208
- all_tasks = completed_tasks + failed_tasks
209
-
210
- if all_tasks:
211
- task_history += "### Task Execution History (chronological):\n"
212
- for i, task in enumerate(all_tasks, 1):
213
- if hasattr(task, 'description'):
214
- status_indicator = "[success]" if hasattr(task, 'status') and task.status == "completed" else "[failed]"
215
- task_history += f"{i}. {status_indicator} {task.description}\n"
216
- elif isinstance(task, dict):
217
- # For backward compatibility with dict format
218
- task_description = task.get('description', str(task))
219
- status_indicator = "[success]" if task in completed_tasks else "[failed]"
220
- task_history += f"{i}. {status_indicator} {task_description}\n"
221
- else:
222
- status_indicator = "[success]" if task in completed_tasks else "[failed]"
223
- task_history += f"{i}. {status_indicator} {task}\n"
224
+ indicator = f"[{status_value}]"
224
225
 
225
-
226
- task_block = TextBlock(text=f"{task_history}")
226
+ lines.append(f"{index}. {indicator} {description}")
227
+
228
+ task_block = TextBlock(text="\n".join(lines))
227
229
 
228
230
  chat_history = chat_history.copy()
229
231
  chat_history[-1] = message_copy(chat_history[-1])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: droidrun
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A framework for controlling Android devices through LLM agents
5
5
  Project-URL: Homepage, https://github.com/droidrun/droidrun
6
6
  Project-URL: Bug Tracker, https://github.com/droidrun/droidrun/issues
@@ -13,7 +13,7 @@ droidrun/agent/context/agent_persona.py,sha256=Mxd4HTyirWD-aqNlka1hQBdS-0I-lXJr2
13
13
  droidrun/agent/context/context_injection_manager.py,sha256=sA33q2KPtX_4Yap8wM11T6ewlZC_0FIbKPEc400SHrE,2188
14
14
  droidrun/agent/context/episodic_memory.py,sha256=1ImeR3jAWOpKwkQt3bMlXVOBiQbIli5fBIlBq2waREQ,394
15
15
  droidrun/agent/context/reflection.py,sha256=0hJluOz0hTlHHhReKpIJ9HU5aJbaJsvrjMfraQ84D-M,652
16
- droidrun/agent/context/task_manager.py,sha256=RqIBBLcw_hLotaO0JFsm8HOdJ_UdNttSGRGl_3GqRY4,4648
16
+ droidrun/agent/context/task_manager.py,sha256=9CDax1G48DRcqPm1JYy9UiLI7wPsF34eqAM0dRDCC1k,4992
17
17
  droidrun/agent/context/personas/__init__.py,sha256=oSRa8g_xngX7JPIRPu7fLO33m3r7fdEQzIuORuqcw5M,232
18
18
  droidrun/agent/context/personas/app_starter.py,sha256=dHeknznxGEPJ7S6VPyEG_MB-HvAvQwUOnRWaShaV8Xo,1585
19
19
  droidrun/agent/context/personas/big_agent.py,sha256=Gl_y4ykz3apGc203-KG2UbSOwf7gDUiWh7GOVyiLn-Y,5091
@@ -25,11 +25,11 @@ droidrun/agent/droid/events.py,sha256=hjYpWcSffqP83rNv_GyOEc3CNSrdvlVPdUkaRU6QDJ
25
25
  droidrun/agent/oneflows/reflector.py,sha256=I_tE0PBjvwWbS6SA8Qd41etxJglFgn8oScuKUxc9LEE,11621
26
26
  droidrun/agent/planner/__init__.py,sha256=Fu0Ewtd-dIRLgHIL1DB_9EEKvQS_f1vjB8jgO5TbJXg,364
27
27
  droidrun/agent/planner/events.py,sha256=oyt2FNrA2uVyUeVT65-N0AC6sWBFxSnwNEqWtnRYoFM,390
28
- droidrun/agent/planner/planner_agent.py,sha256=gqXMj1PcTdmKpSGM1b6T_q7ojFptPgx39wAXuW3ZQDQ,10854
28
+ droidrun/agent/planner/planner_agent.py,sha256=KELaoNOcoyB0He0B_A4iCi-hFyOTVO-s4-UclbQ7YjM,10910
29
29
  droidrun/agent/planner/prompts.py,sha256=Ci7Oeu3J4TAhx-tKGPZ9l6Wb3a81FSqC8cWW4jW73HI,6046
30
30
  droidrun/agent/utils/__init__.py,sha256=JK6ygRjw7gzcQSG0HBEYLoVGH54QQAxJJ7HpIS5mgyc,44
31
31
  droidrun/agent/utils/async_utils.py,sha256=IQBcWPwevm89B7R_UdMXk0unWeNCBA232b5kQGqoxNI,336
32
- droidrun/agent/utils/chat_utils.py,sha256=SNn-wJSyxiirDWDqAeLehHw4ByNX_6dD5Bx3Inc6Sj0,13008
32
+ droidrun/agent/utils/chat_utils.py,sha256=KzmiNasXb9d0qH12ylRsWooKV4_9LXy_QifaD_xf_O0,12726
33
33
  droidrun/agent/utils/executer.py,sha256=-iwdZpmpF0w116D7A_eDgeV0ZNXSuotVgBkM5lc0BNI,5202
34
34
  droidrun/agent/utils/llm_picker.py,sha256=16tNkNhEM9gD_uivzxLvuaa6s0Tz7Igu-3fxMP2lAtY,5968
35
35
  droidrun/agent/utils/trajectory.py,sha256=PU3nI3Zru580_bK0TvqUaf-5kiWvj6hFoedXkDgTqdc,17047
@@ -47,8 +47,8 @@ droidrun/tools/__init__.py,sha256=9ReauavtSKDQG9ya9_Fr9O0TQnDFixgOPaP5n82_iEk,27
47
47
  droidrun/tools/adb.py,sha256=zFnVydQi42GZ1vh-4HT79dCQVBeCS6VObywyaIUUCmw,40832
48
48
  droidrun/tools/ios.py,sha256=imzojiS6gqz4IKexUEz1ga7-flSOaC5QRpHIJTwcgSQ,21807
49
49
  droidrun/tools/tools.py,sha256=rqDe2gRyR45HVM15SwsW1aCTVZo5eleTxlh2hGqCHys,4785
50
- droidrun-0.3.4.dist-info/METADATA,sha256=C7rh3674hF4xvKES0DfXTQaErn1RckdUBmrNcrito_o,6685
51
- droidrun-0.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
- droidrun-0.3.4.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
53
- droidrun-0.3.4.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
54
- droidrun-0.3.4.dist-info/RECORD,,
50
+ droidrun-0.3.5.dist-info/METADATA,sha256=k4-cv0Vud2ol8yqc1qkKWWxp2OrGxL12yeS-YUpc4K4,6685
51
+ droidrun-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
+ droidrun-0.3.5.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
53
+ droidrun-0.3.5.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
54
+ droidrun-0.3.5.dist-info/RECORD,,