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.
- droidrun/__init__.py +2 -3
- droidrun/__main__.py +1 -1
- droidrun/agent/__init__.py +1 -1
- droidrun/agent/codeact/__init__.py +1 -4
- droidrun/agent/codeact/codeact_agent.py +112 -48
- droidrun/agent/codeact/events.py +6 -3
- droidrun/agent/codeact/prompts.py +2 -2
- droidrun/agent/common/constants.py +2 -0
- droidrun/agent/common/events.py +5 -3
- droidrun/agent/context/__init__.py +1 -3
- droidrun/agent/context/agent_persona.py +2 -1
- droidrun/agent/context/context_injection_manager.py +6 -6
- droidrun/agent/context/episodic_memory.py +5 -3
- droidrun/agent/context/personas/__init__.py +3 -3
- droidrun/agent/context/personas/app_starter.py +3 -3
- droidrun/agent/context/personas/big_agent.py +3 -3
- droidrun/agent/context/personas/default.py +3 -3
- droidrun/agent/context/personas/ui_expert.py +5 -5
- droidrun/agent/context/task_manager.py +15 -17
- droidrun/agent/droid/__init__.py +1 -1
- droidrun/agent/droid/droid_agent.py +327 -182
- droidrun/agent/droid/events.py +91 -9
- droidrun/agent/executor/__init__.py +13 -0
- droidrun/agent/executor/events.py +24 -0
- droidrun/agent/executor/executor_agent.py +327 -0
- droidrun/agent/executor/prompts.py +136 -0
- droidrun/agent/manager/__init__.py +18 -0
- droidrun/agent/manager/events.py +20 -0
- droidrun/agent/manager/manager_agent.py +459 -0
- droidrun/agent/manager/prompts.py +223 -0
- droidrun/agent/oneflows/app_starter_workflow.py +118 -0
- droidrun/agent/oneflows/text_manipulator.py +204 -0
- droidrun/agent/planner/__init__.py +3 -3
- droidrun/agent/planner/events.py +6 -3
- droidrun/agent/planner/planner_agent.py +60 -53
- droidrun/agent/planner/prompts.py +2 -2
- droidrun/agent/usage.py +15 -13
- droidrun/agent/utils/__init__.py +11 -1
- droidrun/agent/utils/async_utils.py +2 -1
- droidrun/agent/utils/chat_utils.py +48 -60
- droidrun/agent/utils/device_state_formatter.py +177 -0
- droidrun/agent/utils/executer.py +13 -12
- droidrun/agent/utils/inference.py +114 -0
- droidrun/agent/utils/llm_picker.py +2 -0
- droidrun/agent/utils/message_utils.py +85 -0
- droidrun/agent/utils/tools.py +220 -0
- droidrun/agent/utils/trajectory.py +8 -7
- droidrun/cli/__init__.py +1 -1
- droidrun/cli/logs.py +29 -28
- droidrun/cli/main.py +279 -143
- droidrun/config_manager/__init__.py +25 -0
- droidrun/config_manager/config_manager.py +583 -0
- droidrun/macro/__init__.py +2 -2
- droidrun/macro/__main__.py +1 -1
- droidrun/macro/cli.py +36 -34
- droidrun/macro/replay.py +7 -9
- droidrun/portal.py +1 -1
- droidrun/telemetry/__init__.py +2 -2
- droidrun/telemetry/events.py +3 -4
- droidrun/telemetry/phoenix.py +173 -0
- droidrun/telemetry/tracker.py +7 -5
- droidrun/tools/__init__.py +1 -1
- droidrun/tools/adb.py +210 -82
- droidrun/tools/ios.py +7 -5
- droidrun/tools/tools.py +25 -8
- {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/METADATA +13 -7
- droidrun-0.3.10.dev2.dist-info/RECORD +70 -0
- droidrun/agent/common/default.py +0 -5
- droidrun/agent/context/reflection.py +0 -20
- droidrun/agent/oneflows/reflector.py +0 -265
- droidrun-0.3.8.dist-info/RECORD +0 -55
- {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/WHEEL +0 -0
- {droidrun-0.3.8.dist-info → droidrun-0.3.10.dev2.dist-info}/entry_points.txt +0 -0
- {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
|
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:
|
droidrun/agent/droid/__init__.py
CHANGED