Files
oO/apps/admin/README.md
alvis faf44c18fc feat: ε-greedy v1 as active policy; dwell-time reward inference; offline sim framework
- Promote egreedy-v1 to active serving policy (ADR-0007): /score/egreedy + /reward/egreedy
  replaces linucb-v1 endpoints after offline sim shows +10.7% mean reward (−0.548 vs −0.606)
- Replace explicit helpful/not_helpful feedback with dwell-time inferred reward (inferReward):
  dismiss=−1.0, snooze=+0.1, done<15s=−0.3, done 15s–2min=+1.0, done 2–10min=+0.6, done>10min=+0.3
- Add ml/serving ε-greedy endpoints: /score/egreedy, /reward/egreedy, /stats/egreedy/{user_id}
  with d=7 feature vector (base 5 + sin/cos day-of-week encoding)
- Add offline simulation framework (ml/experiments/sim): rule/LLM/claude-code judges,
  two-phase score+reward, synthetic personas, task generator; results stored in sim_runs/sim_events
- Add /admin/simulations page: start runs, live-poll status, reward curve SVG, action/persona tables
- Fix egreedy day_of_week training skew: reward endpoint now uses actual dow instead of hardcoded 0
- Fix runner.py proxy bypass: httpx.Client(trust_env=False) for localhost ML calls
- Add dwellMs to TipFeedbackEvent contract and bus.test.ts fixture
- Schema: sim_runs, sim_events tables; tip_feedback gains dwell_ms, reward_milli columns
- ADR-0006: admin console framework; ADR-0007: egreedy-v1 policy selection rationale

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 07:44:37 +00:00

1.4 KiB

apps/admin — oO Admin Console

Next.js 15 app. Deployed at admin.o.alogins.net (dev: http://localhost:3080).

Contract

  • All routes are admin-only. The Next.js middleware calls GET /api/user/me on every request and checks role === 'admin'. First admin is seeded via ADMIN_SEED_EMAIL env var at API startup.
  • Admin write actions are appended to the admin_actions audit log in the DB.

Pages

Route Description
/ Overview: DAU/WAU KPI cards, tips served, reaction breakdown, activation funnel
/users User list (paginated)
/users/:id User detail: identity, consents, integrations, tip stats, reward history; revoke-integration + reset-bandit actions
/audit Admin action audit log
/events Event stream viewer (stub — pending API history endpoint)

Dev

pnpm --filter @oo/admin dev   # starts on :3080
# also run the API: pnpm --filter @oo/api dev  (port 3078)

Extraction criteria

Stays as a Next.js app in the monorepo permanently — it's not a candidate for extraction. It gets richer (more pages, embedded MLflow/Grafana) but not split.

Known issues

  • @tremor/react 3.x declares a peer dep on React 18; the workspace uses React 19. Works in practice. Will resolve naturally when Tremor ships React 19 support or when we switch to Tremor v4 (which targets React 18+).