droidrun 0.3.8__py3-none-any.whl → 0.3.10.dev2__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.
Files changed (74) hide show
  1. droidrun/__init__.py +2 -3
  2. droidrun/__main__.py +1 -1
  3. droidrun/agent/__init__.py +1 -1
  4. droidrun/agent/codeact/__init__.py +1 -4
  5. droidrun/agent/codeact/codeact_agent.py +112 -48
  6. droidrun/agent/codeact/events.py +6 -3
  7. droidrun/agent/codeact/prompts.py +2 -2
  8. droidrun/agent/common/constants.py +2 -0
  9. droidrun/agent/common/events.py +5 -3
  10. droidrun/agent/context/__init__.py +1 -3
  11. droidrun/agent/context/agent_persona.py +2 -1
  12. droidrun/agent/context/context_injection_manager.py +6 -6
  13. droidrun/agent/context/episodic_memory.py +5 -3
  14. droidrun/agent/context/personas/__init__.py +3 -3
  15. droidrun/agent/context/personas/app_starter.py +3 -3
  16. droidrun/agent/context/personas/big_agent.py +3 -3
  17. droidrun/agent/context/personas/default.py +3 -3
  18. droidrun/agent/context/personas/ui_expert.py +5 -5
  19. droidrun/agent/context/task_manager.py +15 -17
  20. droidrun/agent/droid/__init__.py +1 -1
  21. droidrun/agent/droid/droid_agent.py +327 -182
  22. droidrun/agent/droid/events.py +91 -9
  23. droidrun/agent/executor/__init__.py +13 -0
  24. droidrun/agent/executor/events.py +24 -0
  25. droidrun/agent/executor/executor_agent.py +327 -0
  26. droidrun/agent/executor/prompts.py +136 -0
  27. droidrun/agent/manager/__init__.py +18 -0
  28. droidrun/agent/manager/events.py +20 -0
  29. droidrun/agent/manager/manager_agent.py +459 -0
  30. droidrun/agent/manager/prompts.py +223 -0
  31. droidrun/agent/oneflows/app_starter_workflow.py +118 -0
  32. droidrun/agent/oneflows/text_manipulator.py +204 -0
  33. droidrun/agent/planner/__init__.py +3 -3
  34. droidrun/agent/planner/events.py +6 -3
  35. droidrun/agent/planner/planner_agent.py +60 -53
  36. droidrun/agent/planner/prompts.py +2 -2
  37. droidrun/agent/usage.py +15 -13
  38. droidrun/agent/utils/__init__.py +11 -1
  39. droidrun/agent/utils/async_utils.py +2 -1
  40. droidrun/agent/utils/chat_utils.py +48 -60
  41. droidrun/agent/utils/device_state_formatter.py +177 -0
  42. droidrun/agent/utils/executer.py +13 -12
  43. droidrun/agent/utils/inference.py +114 -0
  44. droidrun/agent/utils/llm_picker.py +2 -0
  45. droidrun/agent/utils/message_utils.py +85 -0
  46. droidrun/agent/utils/tools.py +220 -0
  47. droidrun/agent/utils/trajectory.py +8 -7
  48. droidrun/cli/__init__.py +1 -1
  49. droidrun/cli/logs.py +29 -28
  50. droidrun/cli/main.py +279 -143
  51. droidrun/config_manager/__init__.py +25 -0
  52. droidrun/config_manager/config_manager.py +583 -0
  53. droidrun/macro/__init__.py +2 -2
  54. droidrun/macro/__main__.py +1 -1
  55. droidrun/macro/cli.py +36 -34
  56. droidrun/macro/replay.py +7 -9
  57. droidrun/portal.py +1 -1
  58. droidrun/telemetry/__init__.py +2 -2
  59. droidrun/telemetry/events.py +3 -4
  60. droidrun/telemetry/phoenix.py +173 -0
  61. droidrun/telemetry/tracker.py +7 -5
  62. droidrun/tools/__init__.py +1 -1
  63. droidrun/tools/adb.py +210 -82
  64. droidrun/tools/ios.py +7 -5
  65. droidrun/tools/tools.py +25 -8
  66. {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/METADATA +13 -7
  67. droidrun-0.3.10.dev2.dist-info/RECORD +70 -0
  68. droidrun/agent/common/default.py +0 -5
  69. droidrun/agent/context/reflection.py +0 -20
  70. droidrun/agent/oneflows/reflector.py +0 -265
  71. droidrun-0.3.8.dist-info/RECORD +0 -55
  72. {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/WHEEL +0 -0
  73. {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/entry_points.txt +0 -0
  74. {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,8 @@
1
+ import copy
1
2
  import os
2
- from typing import List, Dict, Optional
3
3
  from dataclasses import dataclass
4
- import copy
4
+ from typing import Dict, List, Optional
5
+
5
6
 
6
7
  @dataclass
7
8
  class Task:
@@ -14,13 +15,13 @@ class Task:
14
15
  # Optional fields to carry success/failure context back to the planner
15
16
  message: Optional[str] = None
16
17
  failure_reason: Optional[str] = None
17
-
18
+
18
19
 
19
20
  class TaskManager:
20
21
  """
21
22
  Manages a list of tasks for an agent, each with a status and assigned specialized agent.
22
23
  """
23
- STATUS_PENDING = "pending"
24
+ STATUS_PENDING = "pending"
24
25
  STATUS_COMPLETED = "completed"
25
26
  STATUS_FAILED = "failed"
26
27
 
@@ -32,14 +33,14 @@ class TaskManager:
32
33
  def __init__(self):
33
34
  """Initializes an empty task list."""
34
35
  self.tasks: List[Task] = []
35
- self.goal_completed = False
36
+ self.goal_completed = False
36
37
  self.message = None
37
- self.task_history = []
38
+ self.task_history = []
38
39
  self.file_path = os.path.join(os.path.dirname(__file__), "todo.txt")
39
40
 
40
41
  def get_all_tasks(self) -> List[Task]:
41
42
  return self.tasks
42
-
43
+
43
44
  def get_task_history(self):
44
45
  return self.task_history
45
46
 
@@ -67,9 +68,6 @@ class TaskManager:
67
68
 
68
69
  def get_failed_tasks(self) -> list[dict]:
69
70
  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
73
71
 
74
72
 
75
73
  def save_to_file(self):
@@ -89,12 +87,12 @@ class TaskManager:
89
87
  def set_tasks_with_agents(self, task_assignments: List[Dict[str, str]]):
90
88
  """
91
89
  Clears the current task list and sets new tasks with their assigned agents.
92
-
90
+
93
91
  Args:
94
92
  task_assignments: A list of dictionaries, each containing:
95
93
  - 'task': The task description string
96
94
  - 'agent': The agent type
97
-
95
+
98
96
  Example:
99
97
  task_manager.set_tasks_with_agents([
100
98
  {'task': 'Open Gmail app', 'agent': 'AppStarterExpert'},
@@ -106,21 +104,21 @@ class TaskManager:
106
104
  for i, assignment in enumerate(task_assignments):
107
105
  if not isinstance(assignment, dict) or 'task' not in assignment:
108
106
  raise ValueError(f"Each task assignment must be a dictionary with 'task' key at index {i}.")
109
-
107
+
110
108
  task_description = assignment['task']
111
109
  if not isinstance(task_description, str) or not task_description.strip():
112
110
  raise ValueError(f"Task description must be a non-empty string at index {i}.")
113
-
111
+
114
112
  agent_type = assignment.get('agent', 'Default')
115
-
113
+
116
114
  task_obj = Task(
117
115
  description=task_description.strip(),
118
116
  status=self.STATUS_PENDING,
119
117
  agent_type=agent_type
120
118
  )
121
-
119
+
122
120
  self.tasks.append(task_obj)
123
-
121
+
124
122
  print(f"Tasks set with agents: {len(self.tasks)} tasks added.")
125
123
  self.save_to_file()
126
124
  except Exception as e:
@@ -10,4 +10,4 @@ from droidrun.agent.droid.droid_agent import DroidAgent
10
10
  __all__ = [
11
11
  "CodeActAgent",
12
12
  "DroidAgent"
13
- ]
13
+ ]