run.py 549 B

123456789101112131415161718192021222324
  1. from dataclasses import dataclass
  2. from .base import Observation
  3. from opendevin.schema import ObservationType
  4. @dataclass
  5. class CmdOutputObservation(Observation):
  6. """
  7. This data class represents the output of a command.
  8. """
  9. command_id: int
  10. command: str
  11. exit_code: int = 0
  12. observation: str = ObservationType.RUN
  13. @property
  14. def error(self) -> bool:
  15. return self.exit_code != 0
  16. @property
  17. def message(self) -> str:
  18. return f'Command `{self.command}` executed with exit code {self.exit_code}.'