Spaces:
Sleeping

File size: 1,257 Bytes
3889923
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import Dict, Any, List, Optional
from pydantic import BaseModel, Field
from openenv_core.env_server.types import Action, Observation, State

class CodeReviewAction(Action):
    action_type: str = Field(description="'classify_issue' | 'suggest_fix' | 'write_fix' | 'skip'")
    hunk_id: str = Field(description="ID of the hunk being reviewed")
    issue_type: str = Field(description="'bug' | 'style' | 'security' | 'performance' | 'none'")
    severity: str = Field(description="'critical' | 'major' | 'minor' | 'info'")
    suggestion: str = Field(default="", description="free-text fix or actual corrected code")

class CodeReviewObservation(Observation):
    hunks: List[Dict] = Field(description="remaining hunks (id, language, diff only)")
    current_hunk: Optional[Dict] = Field(description="the hunk to act on right now")
    task_id: str = Field(description="which task is active")
    progress: float = Field(description="0.0 to 1.0 completion ratio")
    step_count: int = Field(description="current step")
    last_feedback: Optional[str] = Field(description="reward feedback from previous step")

class CodeReviewState(State):
    task_id: str = "easy_classify"
    visited_hunks: List[str] = []
    accumulated_rewards: float = 0.0