""" Data models for Code Debugging Challenge environment. """ from dataclasses import dataclass, field from typing import Optional, Literal from openenv.core.env_server import Action, Observation, State @dataclass class DebugAction(Action): """Actions the agent can take in the debugging environment.""" action_type: Literal["analyze", "fix", "test", "submit"] content: Optional[str] = None def __post_init__(self): """Validate action consistency.""" if self.action_type == "fix" and self.content is None: raise ValueError("fix action requires content") @dataclass class DebugObservation(Observation): """Observations returned to the agent after each step.""" buggy_code: str expected_output: str test_inputs: list[str] = field(default_factory=list) current_output: Optional[str] = None error_message: Optional[str] = None attempts_remaining: int = 5 hint: Optional[str] = None success: bool = False @dataclass class DebugState(State): """Internal state tracking for the environment.""" current_problem_index: int = 0 attempts_made: int = 0 max_attempts: int = 5 score: float = 0.0 solved: bool = False total_problems: int = 7 episode_id: str = ""