Add Google Contacts integration and fix critical Windows issues

- Add People API integration with contact management tools (create, list, get)
- Fix OAuth flow: replace deprecated OOB with localhost callback
- Fix Ctrl+C handling with proper signal handlers for graceful shutdown
- Fix UTF-8 encoding in scheduled_tasks.py for Windows compatibility
- Add users/ directory to gitignore to protect personal data

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 15:12:01 -07:00
parent 19af20e700
commit 0eb5d2cab4
7 changed files with 557 additions and 52 deletions

View File

@@ -14,6 +14,8 @@ Environment variables:
import argparse
import asyncio
import signal
import sys
import traceback
from dotenv import load_dotenv
@@ -45,6 +47,7 @@ class BotRunner:
self.runtime: AdapterRuntime = None
self.agent: Agent = None
self.scheduler: TaskScheduler = None
self.shutdown_event = asyncio.Event()
def _load_adapter(self, platform: str) -> bool:
"""Load and register a single adapter. Returns True if loaded."""
@@ -127,6 +130,17 @@ class BotRunner:
if not self.setup():
return
# Set up signal handlers
loop = asyncio.get_running_loop()
def signal_handler(signum, frame):
print(f"\n\n[Shutdown] Received signal {signum}...")
loop.call_soon_threadsafe(self.shutdown_event.set)
# Register signal handlers (works on both Windows and Unix)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
print("\n" + "=" * 60)
print("Starting bot...")
print("=" * 60 + "\n")
@@ -143,11 +157,9 @@ class BotRunner:
print("Bot is running! Press Ctrl+C to stop.")
print("=" * 60 + "\n")
while True:
await asyncio.sleep(1)
# Wait for shutdown signal
await self.shutdown_event.wait()
except KeyboardInterrupt:
print("\n\n[Shutdown] Received interrupt signal...")
except Exception as e:
print(f"\n[Error] {e}")
traceback.print_exc()