Spaces:
Sleeping
Sleeping
Update models.py
Browse files
models.py
CHANGED
|
@@ -1,15 +1,26 @@
|
|
| 1 |
-
from pydantic import Field
|
| 2 |
-
from typing import Optional, List
|
| 3 |
-
from openenv.core.env_server import Action, Observation
|
| 4 |
-
|
| 5 |
-
class
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import Field, BaseModel
|
| 2 |
+
from typing import Optional, List, Dict
|
| 3 |
+
from openenv.core.env_server import Action, Observation
|
| 4 |
+
|
| 5 |
+
class URLInfo(BaseModel):
|
| 6 |
+
url: str
|
| 7 |
+
is_shortened: bool
|
| 8 |
+
domain_age_days: int
|
| 9 |
+
has_ssl: bool
|
| 10 |
+
reputation_score: float # 0.0 (Malicious) to 1.0 (Safe)
|
| 11 |
+
|
| 12 |
+
class MyEnvV4Observation(Observation):
|
| 13 |
+
"""Enhanced Observation Space for the Security Agent."""
|
| 14 |
+
sender: str
|
| 15 |
+
subject: str
|
| 16 |
+
body: str
|
| 17 |
+
raw_headers: str
|
| 18 |
+
hop_count: int
|
| 19 |
+
auth_results: Dict[str, str] # e.g., {"SPF": "pass", "DKIM": "fail"}
|
| 20 |
+
urls: List[URLInfo]
|
| 21 |
+
echoed_message: str = ""
|
| 22 |
+
|
| 23 |
+
class MyEnvV4Action(Action):
|
| 24 |
+
"""Enhanced Action Space with Explainability."""
|
| 25 |
+
message: str = Field(..., description="Classification: 'INBOX', 'SPAM', or 'QUARANTINE'")
|
| 26 |
+
reasoning: str = Field(..., description="Justification for the triage decision (e.g., 'Suspicious URL and failed SPF')")
|