56 lines
1.7 KiB
Python
56 lines
1.7 KiB
Python
import time
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
|
|
|
|
class ApprovalStatus(Enum):
|
|
PENDING = "pending"
|
|
APPROVED = "approved"
|
|
REJECTED = "rejected"
|
|
TIMEOUT = "timeout"
|
|
|
|
|
|
@dataclass
|
|
class ApprovalRequest:
|
|
"""An approval request from Antigravity."""
|
|
request_id: str
|
|
conversation_id: str
|
|
command: str # The command/action needing approval
|
|
description: str # Human-readable description
|
|
timestamp: float
|
|
status: str = "pending"
|
|
discord_message_id: int = 0
|
|
project_name: str = "" # Project routing key
|
|
step_type: str = "" # e.g. 'diff_review', passed through to response
|
|
safe_to_auto_run: bool = False # Allows bot to silently auto-approve
|
|
|
|
|
|
@dataclass
|
|
class UserResponse:
|
|
"""A user response from Discord."""
|
|
request_id: str
|
|
approved: bool
|
|
user_input: str = ""
|
|
timestamp: float = field(default_factory=time.time)
|
|
button_index: int = -1 # -1 = legacy (approve/reject), 0+ = specific button index
|
|
step_type: str = "" # pass through from pending for extension routing
|
|
project_name: str = "" # for multi-project: extension uses this when pending file is missing
|
|
|
|
|
|
class EventType(Enum):
|
|
"""Types of brain events."""
|
|
SESSION_START = "session_start" # New conversation directory created
|
|
FILE_CHANGED = "file_changed" # Watched file modified
|
|
FILE_CREATED = "file_created" # Watched file first created
|
|
|
|
|
|
@dataclass
|
|
class BrainEvent:
|
|
"""An event from the brain directory."""
|
|
event_type: EventType
|
|
conversation_id: str
|
|
file_name: str = ""
|
|
file_path: str = None
|
|
content: str = ""
|
|
timestamp: float = field(default_factory=time.time)
|