feat: centralize AI logic in @repo/ai-sdk, harmonize worker HTTP clients
CognxSafeTrack+1: Claude Sonnet 4.6
2849f33
Architecture refactoring:
- Extract all AI providers (OpenAI, Gemini, ProviderRegistry, ffmpeg, search)
from apps/api/src/services/ai/ into new packages/ai-sdk package
- API's services/ai/index.ts is now a thin wrapper that injects prisma,
redis and organization context into the shared AIService
- Worker gains @repo/ai-sdk dependency; ai-pedagogy.ts delegates to
aiService.generatePersonalizedLesson instead of duplicating logic
- New apiClient (Axios, 30s timeout) and whatsappClient replace bare fetch
calls in InboundHandler and MediaHandler for consistent error handling
- Prisma seed fixed: Tracks now include organizationId for multi-tenant compliance
Build: all 8 packages pass pnpm turbo run build from clean state.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>