|
|
|
|
@ -72,6 +72,13 @@ class TaskSteps(BaseModel):
|
|
|
|
|
steps: list[Step]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEV_WAIT_TEST = "Awaiting user test"
|
|
|
|
|
DEV_TASK_STARTING = "Starting task #{}"
|
|
|
|
|
DEV_TASK_BREAKDOWN = "Task #{} breakdown"
|
|
|
|
|
DEV_TROUBLESHOOT = "Troubleshooting #{}"
|
|
|
|
|
DEV_TASK_REVIEW_FEEDBACK = "Task review feedback"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
agent_type = "developer"
|
|
|
|
|
display_name = "Developer"
|
|
|
|
|
@ -163,19 +170,20 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
):
|
|
|
|
|
# This is just a support for old iterations that don't have status
|
|
|
|
|
self.next_state.complete_iteration()
|
|
|
|
|
self.next_state.action = f"Troubleshooting #{len(self.current_state.iterations)}"
|
|
|
|
|
self.next_state.action = DEV_TROUBLESHOOT.format(len(self.current_state.iterations))
|
|
|
|
|
elif iteration["status"] == IterationStatus.IMPLEMENT_SOLUTION:
|
|
|
|
|
# If the user requested a change, then, we'll implement it and go straight back to testing
|
|
|
|
|
self.next_state.complete_iteration()
|
|
|
|
|
self.next_state.action = f"Troubleshooting #{len(self.current_state.iterations)}"
|
|
|
|
|
self.next_state.action = DEV_TROUBLESHOOT.format(len(self.current_state.iterations))
|
|
|
|
|
elif iteration["status"] == IterationStatus.AWAITING_BUG_FIX:
|
|
|
|
|
# If bug fixing is done, ask user to test again
|
|
|
|
|
self.next_state.action = DEV_WAIT_TEST
|
|
|
|
|
self.next_state.current_iteration["status"] = IterationStatus.AWAITING_USER_TEST
|
|
|
|
|
elif iteration["status"] == IterationStatus.AWAITING_LOGGING:
|
|
|
|
|
# If logging is done, ask user to reproduce the bug
|
|
|
|
|
self.next_state.current_iteration["status"] = IterationStatus.AWAITING_BUG_REPRODUCTION
|
|
|
|
|
else:
|
|
|
|
|
self.next_state.action = "Task review feedback"
|
|
|
|
|
self.next_state.action = DEV_TASK_REVIEW_FEEDBACK
|
|
|
|
|
|
|
|
|
|
current_task_index = self.current_state.tasks.index(current_task)
|
|
|
|
|
self.next_state.tasks[current_task_index] = {
|
|
|
|
|
@ -186,6 +194,9 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
|
|
|
|
|
async def breakdown_current_task(self) -> AgentResponse:
|
|
|
|
|
current_task = self.current_state.current_task
|
|
|
|
|
current_task_index = self.current_state.tasks.index(current_task)
|
|
|
|
|
self.next_state.action = DEV_TASK_BREAKDOWN.format(current_task_index + 1)
|
|
|
|
|
|
|
|
|
|
source = self.current_state.current_epic.get("source", "app")
|
|
|
|
|
await self.ui.send_task_progress(
|
|
|
|
|
self.current_state.tasks.index(current_task) + 1,
|
|
|
|
|
@ -203,8 +214,6 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
# Check which files are relevant to the current task
|
|
|
|
|
await self.get_relevant_files_parallel()
|
|
|
|
|
|
|
|
|
|
current_task_index = self.current_state.tasks.index(current_task)
|
|
|
|
|
|
|
|
|
|
await self.send_message("Thinking about how to implement this task ...")
|
|
|
|
|
|
|
|
|
|
await self.ui.start_breakdown_stream()
|
|
|
|
|
@ -246,7 +255,6 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
# There might be state leftovers from previous tasks that we need to clean here
|
|
|
|
|
self.next_state.modified_files = {}
|
|
|
|
|
self.set_next_steps(response, source)
|
|
|
|
|
self.next_state.action = f"Task #{current_task_index + 1} start"
|
|
|
|
|
await telemetry.trace_code_event(
|
|
|
|
|
"task-start",
|
|
|
|
|
{
|
|
|
|
|
@ -314,6 +322,7 @@ class Developer(ChatWithBreakdownMixin, RelevantFilesMixin, BaseAgent):
|
|
|
|
|
"task_index": task_index,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
self.next_state.action = DEV_TASK_STARTING.format(task_index)
|
|
|
|
|
await self.send_message(f"Starting task #{task_index} with the description:\n\n" + description)
|
|
|
|
|
if self.current_state.run_command:
|
|
|
|
|
await self.ui.send_run_command(self.current_state.run_command)
|
|
|
|
|
|