Files
microdao-daarion/gateway-bot/app.py
Apple 0c8bef82f4 feat: Add Alateya, Clan, Eonarch agents + fix gateway-router connection
## Agents Added
- Alateya: R&D, biotech, innovations
- Clan (Spirit): Community spirit agent
- Eonarch: Consciousness evolution agent

## Changes
- docker-compose.node1.yml: Added tokens for all 3 new agents
- gateway-bot/http_api.py: Added configs and webhook endpoints
- gateway-bot/clan_prompt.txt: New prompt file
- gateway-bot/eonarch_prompt.txt: New prompt file

## Fixes
- Fixed ROUTER_URL from :9102 to :8000 (internal container port)
- All 9 Telegram agents now working

## Documentation
- Created PROJECT-MASTER-INDEX.md - single entry point
- Added various status documents and scripts

Tokens configured:
- Helion, NUTRA, Agromatrix (existing)
- Alateya, Clan, Eonarch (new)
- Druid, GreenFood, DAARWIZZ (configured)
2026-01-28 06:40:34 -08:00

69 lines
1.9 KiB
Python

"""
FastAPI app instance for Gateway Bot
"""
import logging
import asyncio
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from http_api import router as gateway_router
from http_api_doc import router as doc_router
from telegram_history_recovery import auto_recover_on_startup_all_agents
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s"
)
app = FastAPI(
title="Bot Gateway with DAARWIZZ",
version="1.0.0",
description="Gateway service for Telegram/Discord bots → DAGI Router"
)
# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Startup event: auto-recover Telegram history
@app.on_event("startup")
async def startup_event():
"""Run on application startup"""
logger = logging.getLogger(__name__)
logger.info("🚀 Bot Gateway startup initiated")
# Auto-recover Telegram history for all agents
try:
logger.info("📊 Starting automatic Telegram history check...")
result = await auto_recover_on_startup_all_agents()
logger.info(f"✅ Telegram history check completed: {result.get('status')}")
except Exception as e:
logger.error(f"❌ Failed to run history recovery on startup: {e}")
# Don't block startup if recovery fails
# Include gateway routes
app.include_router(gateway_router, prefix="", tags=["gateway"])
app.include_router(doc_router, prefix="", tags=["docs"])
@app.get("/")
async def root():
return {
"service": "bot-gateway",
"version": "1.0.0",
"agent": "DAARWIZZ",
"endpoints": [
"POST /telegram/webhook",
"POST /discord/webhook",
"POST /api/doc/parse",
"POST /api/doc/ingest",
"POST /api/doc/ask",
"GET /api/doc/context/{session_id}",
"GET /health"
]
}