feat(deploy): finalize MVP deployment and file transfer approach
This commit is contained in:
parent
6369721876
commit
0f79494fbe
43 changed files with 3078 additions and 645 deletions
|
|
@ -1,7 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from collections.abc import AsyncIterator, Mapping
|
||||
|
||||
import structlog
|
||||
|
||||
from adapter.matrix.store import get_room_meta
|
||||
from core.chat import ChatManager
|
||||
from core.store import StateStore
|
||||
|
|
@ -15,6 +18,13 @@ from sdk.interface import (
|
|||
UserSettings,
|
||||
)
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
|
||||
def _ws_debug_enabled() -> bool:
|
||||
value = os.environ.get("SURFACES_DEBUG_WS", "")
|
||||
return value.strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
class RoutedPlatformClient(PlatformClient):
|
||||
def __init__(
|
||||
|
|
@ -77,7 +87,9 @@ class RoutedPlatformClient(PlatformClient):
|
|||
if callable(close):
|
||||
await close()
|
||||
|
||||
async def _resolve_delegate(self, user_id: str, local_chat_id: str) -> tuple[PlatformClient, str]:
|
||||
async def _resolve_delegate(
|
||||
self, user_id: str, local_chat_id: str
|
||||
) -> tuple[PlatformClient, str]:
|
||||
chat = await self._chat_mgr.get(local_chat_id, user_id)
|
||||
if chat is None:
|
||||
raise PlatformError(
|
||||
|
|
@ -107,4 +119,15 @@ class RoutedPlatformClient(PlatformClient):
|
|||
code="MATRIX_AGENT_NOT_FOUND",
|
||||
)
|
||||
|
||||
if _ws_debug_enabled():
|
||||
logger.warning(
|
||||
"matrix_route_resolved",
|
||||
user_id=user_id,
|
||||
local_chat_id=local_chat_id,
|
||||
surface_ref=chat.surface_ref,
|
||||
agent_id=str(agent_id),
|
||||
platform_chat_id=str(platform_chat_id),
|
||||
delegate_type=type(delegate).__name__,
|
||||
)
|
||||
|
||||
return delegate, str(platform_chat_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue