"""Actions and observations for Terminal Desk v2. These reproduce the upstream OpenEnv ``envs/tbench2_env`` models (the wrapper the arena operator uses for its own Terminal-Bench 2 tasks) field for field, so the schema the policy trains against here equals the one it meets on the private tasks. tests/fixtures/tb2_schema.json is the operator's published schema; a test diffs ours against it. """ from typing import Optional from openenv.core.env_server.types import Action, Observation, State from pydantic import Field class Tbench2Action(Action): """Action for interacting with a TB2 task session.""" action_type: str = Field(default="exec") command: str = Field(default="") session_id: Optional[str] = Field(default=None) block: bool = Field(default=True) wait_seconds: Optional[float] = Field(default=None) file_path: str = Field(default="") content: str = Field(default="") class Tbench2Observation(Observation): """Observation returned from the TB2 environment.""" instruction: str = Field(default="") output: str = Field(default="") success: bool = Field(default=True) error: str = Field(default="") task_id: str = Field(default="") task_path: str = Field(default="") session_id: Optional[str] = Field(default=None) action_type: str = Field(default="") info: dict = Field(default_factory=dict) class Tbench2State(State): """Server-side state for a TB2 task.""" task_id: str = Field(default="") task_path: str = Field(default="") session_id: str = Field(default="") terminal_ready: bool = Field(default=False) last_action_type: str = Field(default="") last_command: str = Field(default="") last_output: str = Field(default="")