refactor(bridge): migrate gravity bridge to pure websocket gateway architecture, deleting legacy local file scanners and dependencies
This commit is contained in:
55
models.py
Normal file
55
models.py
Normal file
@@ -0,0 +1,55 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user