Commit 19aca6

2026-08-07 11:34:17 admin: init
/dev/null .. 07-services-apis-vendors.md
@@ 0,0 1,89 @@
+ ---
+ title: Services, APIs & Vendors
+ aliases: [Vendor Inventory, API Inventory]
+ tags: [3netra/wiki, vendors, apis, services]
+ product: 3netra Meta Android App
+ source_repository: 3Netra-ai/3n_meta_android
+ source_ref: origin/prod
+ source_revision: b48aada8fd5427b5db0c02945569963c4ae543c8
+ last_verified: 2026-08-06
+ up: "[[Home]]"
+ ---
+
+ # Services, APIs & Vendors
+
+ ## Vendor Inventory
+
+ > [!warning] Audit correction
+ > A listed vendor is not proof of an operational integration. In particular, the active app calls Supabase `chat-vision` (not the AWS client) and discards its returned model text; Sarvam has no end-to-end test; and the DAT gesture bridge is not present. The table records source inventory, with this correction taking precedence over legacy checkmarks.
+
+ | Vendor | Purpose | Endpoint / Transport | Auth / Key source | Status |
+ |---|---|---|---|---|
+ | **Meta (Wearables DAT SDK)** | Registration, device state, camera capture API | DAT SDK / Bluetooth | Manifest meta-data resolves from Gradle resources; fallback values are committed in `app/build.gradle` (rotate/remove) | ๐ŸŸก code path; no hardware verification or gesture callback registration |
+ | **Supabase** | Auth (GoTrue), Postgres (PostgREST), Realtime | `BuildConfig.SUPABASE_URL` | `SUPABASE_ANON_KEY` | โœ… primary |
+ | **OpenAI** | Edge Function implementation requests `gpt-4o` | Supabase `chat-vision` Edge Function | Edge-function environment variable | ๐ŸŸก app invokes it, but client discards its reply |
+ | **AWS** | Unreferenced SAM prototype: Lambda/API Gateway/S3/Rekognition | `AwsBackendService` / `/api/*` | Build config + SAM parameters | ๐ŸŸก source exists; no production app call site |
+ | **Sarvam.ai** | Indic translation, TTS (speaker "meera"), STT (model "saaras:v1") | `https://api.sarvam.ai/translate`, `/text-to-speech`, `/speech-to-text` | `SARVAM_API_KEY` (Bearer + `api-subscription-key`) | โœ… voice |
+ | **Google Identity** | Sign-In (Credential Manager bottom sheet โ†’ ID token โ†’ Supabase IDToken auth) | play-services-auth / credentials API | `GOOGLE_WEB_CLIENT_ID` | โœ… auth |
+ | **TensorFlow Lite (LiteRT)** | FaceNet embedding calculation | In-process; asset `facenet.tflite` | n/a | ๐ŸŸก embedding store/read path is Supabase, not local-only |
+ | **Ollama (LAN)** | Legacy/local VLM client | Hardcoded private-LAN endpoint in `VisionService` | none | โŒ no active production call site |
+ | **Resend** | Welcome/notification emails | Firebase Functions + Vercel function | `RESEND_API_KEY` / functions config | ๐ŸŸก legacy |
+ | **Firebase** | Cloud Functions (email triggers) only โ€” auth/data removed | n/a | n/a | ๐ŸŸก legacy |
+ | **Vercel** | `api/send-welcome.js` serverless (project `3netra`) | vercel.app | env | ๐ŸŸก legacy |
+ | **Android platform** | TextToSpeech, SpeechRecognizer (voice commands, dictation), CameraX (face registration), BLE APIs, EncryptedSharedPreferences | on-device | n/a | โœ… |
+ | **Google ML Kit face-detection** | Declared in build.gradle | โ€” | โ€” | โŒ unused |
+
+ ## Client BuildConfig Keys (names only)
+
+ | Key | Used by |
+ |---|---|
+ | `SUPABASE_URL`, `SUPABASE_ANON_KEY` | SupabaseService |
+ | `AWS_BACKEND_URL` | AwsBackendService only; no production caller at this ref |
+ | `SARVAM_API_KEY` | SarvamService |
+ | `GOOGLE_WEB_CLIENT_ID` | GoogleAuthHelper |
+ | `OPENAI_API_KEY` | Defined but unreferenced in Android code (remove from client build inputs) |
+ | `GITHUB_ACTOR`, `GITHUB_TOKEN` (env) | Meta SDK Maven resolution |
+
+ All sourced from `src/frontend/local.properties` with env fallback. No `local.properties.example` exists.
+
+ ## App Service Layer (Kotlin singletons)
+
+ | Service | Responsibility | External deps |
+ |---|---|---|
+ | `BluetoothService` | Callable mode handlers, capture/AI invocation, chat history, DAT state observation | Meta SDK, Sarvam, Supabase AI, Supabase |
+ | `WearableCameraService` | MWDAT camera session โ†’ photo bytes (mutex-guarded) | Meta SDK |
+ | `SupabaseAiService` | Active `chat-vision` caller; incorrectly returns fixed success text instead of decoding the response | Supabase Functions |
+ | `AwsBackendService` | `/api/chat` client with retry logic; unreferenced by production app code | AWS Lambda |
+ | `SupabaseService` | Auth (email/OTP/Google), profiles, settings, sessions, face embeddings, Realtime | Supabase |
+ | `SupabaseDashboardRepository` | Settings/audit repository methods; no active dashboard/role flow verified | Supabase |
+ | `SarvamService` | translateText / textToSpeech / speechToText | Sarvam.ai |
+ | `VisionService` | Legacy VLM router (Ollama moondream/llava; GPT4_VISION enum) | Ollama LAN |
+ | `FaceNetModel` | TFLite embeddings + cosine similarity | LiteRT |
+ | `VoiceCommandService` | Foreground mic service, BT SCO, broadcasts `VOICE_COMMAND` | Android SpeechRecognizer |
+ | `AudioTranscriptionService` | Continuous lecture dictation | Android SpeechRecognizer |
+ | `EmotionDetectionService` / `HallwayNavigationService` / `RecessSocialService` | Mode-specific prompt wrappers (concise, word-limited) | SupabaseAiService; no active student route for hallway/recess |
+ | `EmergencyAlertManager` | SOS โ†’ Supabase `emergency_alerts` | Supabase |
+ | `ChildVoicePersonaManager` | Scene-screen Android TTS with legacy Kโ€“6 vocabulary filtering | Android TTS |
+ | `PinManager` | Teacher PIN (BCrypt in secure prefs) | jbcrypt |
+ | `SmartCaptureController` | Adaptive capture intervals (battery saver) | โ€” |
+ | `MetaWearableService` | Placeholder stub (no real SDK calls) | โ€” |
+ | Utils: `EncryptedFaceStorageManager`, `MediaCompressor`, `PdfExportManager` | Unused encrypted-face utility ยท pre-upload compression ยท legacy external-storage PDF writer | androidx.security / Android |
+
+ ## API Endpoints Summary
+
+ | Endpoint | Method | Payload | Returns |
+ |---|---|---|---|
+ | Supabase Function `chat-vision` | invoke | `{prompt, mediaType, frames[]}` | Function returns `{message}`, but Android client presently discards it |
+ | `{AWS_BACKEND_URL}/api/chat` | POST | `{prompt, mediaType: NONE/IMAGE/VIDEO, frames[]}` | `{message}`; implemented but not used by production callers |
+ | `{AWS_BACKEND_URL}/api/vision` | POST | `{image_base64}` | `{labels[]}` (Rekognition) |
+ | `{AWS_BACKEND_URL}/api/upload` | POST | `{image_base64}` | S3 file ref |
+ | `{AWS_BACKEND_URL}/api/auth` | POST | `{access_token}` | `{user}` (Supabase verify) |
+ | `api.sarvam.ai/translate` | POST | `{input, source_language_code, target_language_code}` | translated text |
+ | `api.sarvam.ai/text-to-speech` | POST | `{text, speaker: meera, โ€ฆ}` | base64 `audios[]` |
+ | `api.sarvam.ai/speech-to-text` | POST multipart | audio, `model: saaras:v1` | transcript |
+ | Supabase PostgREST | โ€” | client references `user_profiles`, `students`, `student_settings`, `sessions`, `face_embeddings`, `audit_logs`, and `emergency_alerts`; server schema/policies are not committed | โ€” |
+
+ ---
+
+ > [!tip] Navigation
+ > โฌ…๏ธ [[06-Feature-Matrix|Feature Matrix]] ยท ๐Ÿ  [[Home]] ยท โžก๏ธ [[08-Data-Model-Supabase|Data Model (Supabase)]]
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9