Add hybrid outbox + Thompson Sampling for long-tail content discovery
Profile views, event lookups, and thread traversal now additionally query the viewed/referenced author's NIP-65 write relays, scored by Thompson Sampling. The main feed stays on the 4 app relays — no routing changes.
What changes:
- New: src/lib/RelayScorer.ts — per-relay Thompson Sampling scorer, persists to localStorage, auto-flushes every 30s and on page unload
- useProfileFeed.ts — parallel outbox query for viewed author's write relays (top 3 by Thompson score, 1s timeout, merged + deduped)
- useEvent.ts — ranks relay hints and NIP-65 write relays by Thompson score in the existing 3-tier fallback (app relays → hints → outbox)
- nostrEvents.ts — getParentEventRef() extracts relay hint and author pubkey from NIP-10 e-tags (position [2] and [4])
- PostDetailPage.tsx — AncestorThread passes relay/author hints from e-tags to useEvent for better thread discovery
Performance:
- Main feed latency: unchanged (app relays, 100ms EOSE)
- Profile views: app relay results appear at 100ms, outbox results append within 1s (non-blocking)
- Cold start (session 1): identical to current behavior (Beta(1,1) = uniform random). Improvement starts session 2.
- Benchmarked at 89% 1yr event recall (vs 6% with app relays only). See https://github.com/nostrability/outbox for methodology.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com