Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /CIRISAI_CIRISAgent /ciris_engine /protocols /adapters /base.py
| """ | |
| Adapter protocols for the CIRIS Trinity Architecture. | |
| These protocols define contracts for platform adapters. | |
| Adapters are the interfaces between CIRIS and external platforms. | |
| """ | |
| from abc import abstractmethod | |
| from typing import TYPE_CHECKING, Any, Callable, Dict, Optional | |
| if TYPE_CHECKING: | |
| from ciris_engine.logic.adapters.discord.config import DiscordAdapterConfig | |
| from ciris_engine.schemas.infrastructure.base import BusMetrics | |
| from ciris_engine.protocols.runtime.base import BaseAdapterProtocol | |
| from ciris_engine.schemas.types import JSONDict, SerializedModel | |
| # ============================================================================ | |
| # PLATFORM ADAPTER PROTOCOLS | |
| # ============================================================================ | |
| class APIAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for REST API adapter.""" | |
| async def setup_routes(self) -> None: | |
| """Setup all API routes.""" | |
| ... | |
| async def handle_request(self, request: Any) -> Any: | |
| """Handle incoming API request.""" | |
| ... | |
| def get_openapi_spec(self) -> JSONDict: | |
| """Get OpenAPI specification.""" | |
| ... | |
| def add_middleware(self, middleware: Callable[..., Any]) -> None: | |
| """Add middleware to the API.""" | |
| ... | |
| def get_route_metrics(self) -> "BusMetrics": | |
| """Get metrics for each route.""" | |
| ... | |
| class CLIAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for Command Line Interface adapter.""" | |
| def register_commands(self) -> None: | |
| """Register all CLI commands.""" | |
| ... | |
| async def handle_input(self, _: str) -> str: | |
| """Handle CLI input and return response.""" | |
| ... | |
| def show_prompt(self) -> str: | |
| """Get the CLI prompt to display.""" | |
| ... | |
| def get_command_help(self, command: Optional[str] = None) -> str: | |
| """Get help text for commands.""" | |
| ... | |
| def set_output_format(self, format: str) -> None: | |
| """Set output format (text, json, table).""" | |
| ... | |
| class DiscordAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for Discord bot adapter.""" | |
| async def setup_bot(self) -> None: | |
| """Setup Discord bot with commands and events.""" | |
| ... | |
| async def handle_message(self, message: Any) -> None: | |
| """Handle incoming Discord message.""" | |
| ... | |
| async def handle_reaction(self, _: Any, user: Any) -> None: | |
| """Handle reaction events.""" | |
| ... | |
| async def send_message(self, channel_id: str, content: str, embed: Optional[Any] = None) -> Any: | |
| """Send message to Discord channel.""" | |
| ... | |
| def get_guild_config(self, guild_id: str) -> "DiscordAdapterConfig": | |
| """Get configuration for a specific guild.""" | |
| ... | |
| # ============================================================================ | |
| # FUTURE ADAPTER PROTOCOLS | |
| # ============================================================================ | |
| class SlackAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for Slack adapter (future).""" | |
| async def handle_event(self, event: SerializedModel) -> None: | |
| """Handle Slack event.""" | |
| ... | |
| class WebSocketAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for WebSocket adapter (future).""" | |
| async def handle_connection(self, websocket: Any) -> None: | |
| """Handle new WebSocket connection.""" | |
| ... | |
| async def broadcast_message(self, message: Any) -> None: | |
| """Broadcast message to all connected clients.""" | |
| ... | |
| class MatrixAdapterProtocol(BaseAdapterProtocol): | |
| """Protocol for Matrix protocol adapter (future).""" | |
| async def handle_room_message(self, _: Any, event: Any) -> None: | |
| """Handle Matrix room message.""" | |
| ... | |
| async def join_room(self, _: str) -> None: | |
| """Join a Matrix room.""" | |
| ... | |
Xet Storage Details
- Size:
- 4.27 kB
- Xet hash:
- e1ca68226c6b18baf3da31cdb71c987fbcaefa4ac00996c931ef10a0df7bc23b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.