tasks.py 648 B

1234567891011121314151617181920212223242526272829
  1. from dataclasses import dataclass, field
  2. from openhands.core.schema import ActionType
  3. from openhands.events.action.action import Action
  4. @dataclass
  5. class AddTaskAction(Action):
  6. parent: str
  7. goal: str
  8. subtasks: list = field(default_factory=list)
  9. thought: str = ''
  10. action: str = ActionType.ADD_TASK
  11. @property
  12. def message(self) -> str:
  13. return f'Added task: {self.goal}'
  14. @dataclass
  15. class ModifyTaskAction(Action):
  16. task_id: str
  17. state: str
  18. thought: str = ''
  19. action: str = ActionType.MODIFY_TASK
  20. @property
  21. def message(self) -> str:
  22. return f'Set task {self.task_id} to {self.state}'