semblance/src
Vadym Samoilenko 915c81b8f1 Complete phases D–G: quota enforcement, token invalidation, admin writes, backfill
Backend:
- token_version in JWT (bump_token_version, get_token_version on User model);
  jwt_required checks tv claim → 401 on mismatch; login routes embed version
- Quota pre-flight in all 3 LLM public methods (QuotaExceededError bubbles up)
- AI runner catches QuotaExceededError → sets status paused_quota + emits WS event
- Admin routes: POST /users (create), POST /users/<id>/reset-password,
  POST /pricing, GET /focus-groups with aggregated cost; PUT /users/<id>
  now bumps token_version on disable or role change
- backfill_usage.py: idempotent estimated-event generator for historical data,
  tiktoken for GPT models, char/3.8 for Gemini, --dry-run flag

Frontend:
- 402 interceptor dispatches quota_exceeded CustomEvent
- adminApi: createUser, resetPassword, createPricing, listFocusGroups
- UsersTab: New User dialog + Reset Password in edit dialog
- PricingTab: New Price dialog (model, provider, input/output/cached prices)
- FocusGroupsTab: focus groups table sorted by total cost
- Admin.tsx: 4th tab (Focus Groups)
- FocusGroupSession: admin-only cost badge + dismissable quota exceeded banner

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 18:34:48 +01:00
..
components Complete phases D–G: quota enforcement, token invalidation, admin writes, backfill 2026-04-24 18:34:48 +01:00
config Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
contexts Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
hooks Complete phases D–G: quota enforcement, token invalidation, admin writes, backfill 2026-04-24 18:34:48 +01:00
lib Complete phases D–G: quota enforcement, token invalidation, admin writes, backfill 2026-04-24 18:34:48 +01:00
pages Complete phases D–G: quota enforcement, token invalidation, admin writes, backfill 2026-04-24 18:34:48 +01:00
services Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
styles changed permissions 2025-12-19 19:26:16 +00:00
types changed permissions 2025-12-19 19:26:16 +00:00
utils Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
.DS_Store changed permissions 2025-12-19 19:26:16 +00:00
App.tsx Add Phase D admin panel: user management + usage analytics 2026-04-24 18:26:05 +01:00
index.css changed permissions 2025-12-19 19:26:16 +00:00
main.tsx Switch to loginRedirect — popup blocked by server COOP header 2026-03-20 14:44:19 +00:00
vite-env.d.ts changed permissions 2025-12-19 19:26:16 +00:00