feat: Add Loki MCP server scaffold, fix adapter blocking, upgrade model

- Scaffold mcp_servers/loki/ with config and async HTTP client
- Fix Slack/Telegram adapters to use non-blocking connections
- Upgrade default model to claude-sonnet-4-6
- Improve Agent SDK message collection for empty ResultMessage cases
- Add Message-ID to email summaries, increase body truncation limit
- Fix .gitignore inline comments that broke sensitive file exclusions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 21:19:28 -07:00
parent fe7c146dc6
commit a9efdc0a01
9 changed files with 135 additions and 23 deletions

View File

@@ -88,7 +88,8 @@ class SlackAdapter(BaseAdapter):
self.handler = AsyncSocketModeHandler(self.app, app_token)
print("[Slack] Starting Socket Mode connection...")
await self.handler.start_async()
# Connect to Slack (non-blocking)
await self.handler.connect_async()
self.is_running = True
print("[Slack] Connected and listening for messages")
@@ -97,7 +98,7 @@ class SlackAdapter(BaseAdapter):
"""Stop the Slack Socket Mode connection."""
if self.handler:
print("[Slack] Stopping Socket Mode connection...")
await self.handler.close_async()
await self.handler.disconnect_async()
self.is_running = False
print("[Slack] Disconnected")

View File

@@ -4,6 +4,7 @@ Telegram adapter for ajarbot.
Uses python-telegram-bot library for async Telegram Bot API integration.
"""
import asyncio
from typing import Any, Dict, List, Optional
from telegram import Bot, Update
@@ -42,6 +43,7 @@ class TelegramAdapter(BaseAdapter):
super().__init__(config)
self.application: Optional[Application] = None
self.bot: Optional[Bot] = None
self._polling_task: Optional[asyncio.Task] = None
@property
def platform_name(self) -> str:
@@ -86,9 +88,13 @@ class TelegramAdapter(BaseAdapter):
print("[Telegram] Starting bot...")
await self.application.initialize()
await self.application.start()
await self.application.updater.start_polling(
allowed_updates=Update.ALL_TYPES,
drop_pending_updates=True,
# Run polling in a background task instead of blocking
self._polling_task = asyncio.create_task(
self.application.updater.start_polling(
allowed_updates=Update.ALL_TYPES,
drop_pending_updates=True,
)
)
self.is_running = True
@@ -106,7 +112,15 @@ class TelegramAdapter(BaseAdapter):
await self.application.stop()
await self.application.shutdown()
self.is_running = False
print("[Telegram] Bot stopped")
if self._polling_task and not self._polling_task.done():
self._polling_task.cancel()
try:
await self._polling_task
except asyncio.CancelledError:
pass
print("[Telegram] Bot stopped")
def _register_handlers(self) -> None:
"""Register Telegram message handlers."""