41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
from sqlmodel import Session
|
|
|
|
from models.bot import BotInstance
|
|
|
|
|
|
class RuntimeProvider(ABC):
|
|
@abstractmethod
|
|
async def start_bot(self, *, session: Session, bot: BotInstance) -> Dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def stop_bot(self, *, session: Session, bot: BotInstance) -> Dict[str, Any]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def deliver_command(self, *, bot_id: str, command: str, media: Optional[List[str]] = None) -> Optional[str]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_recent_logs(self, *, bot_id: str, tail: int = 300) -> List[str]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def ensure_monitor(self, *, bot_id: str) -> bool:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_monitor_packets(self, *, bot_id: str, after_seq: int = 0, limit: int = 200) -> List[Dict[str, Any]]:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_runtime_status(self, *, bot_id: str) -> str:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_resource_snapshot(self, *, bot_id: str) -> Dict[str, Any]:
|
|
raise NotImplementedError
|