mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
26 lines
550 B
Python
26 lines
550 B
Python
from dataclasses import dataclass
|
|
|
|
from opendevin.schema import ObservationType
|
|
|
|
from .base import Observation
|
|
|
|
|
|
@dataclass
|
|
class CmdOutputObservation(Observation):
|
|
"""
|
|
This data class represents the output of a command.
|
|
"""
|
|
|
|
command_id: int
|
|
command: str
|
|
exit_code: int = 0
|
|
observation: str = ObservationType.RUN
|
|
|
|
@property
|
|
def error(self) -> bool:
|
|
return self.exit_code != 0
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f'Command `{self.command}` executed with exit code {self.exit_code}.'
|