feat: bsky DM subscriptions for standard.site publications
new page at pub-search.waow.tech/subscriptions — sign in with atproto
oauth, see your site.standard.publication records, toggle on to get a
bsky DM whenever pub-search indexes a new doc under that publication.
architecture:
- oauth client uses zat (pattern lifted from ken); scope =
`atproto repo:tech.waow.pub-search.subscription transition:chat.bsky`
- subscription records live on the user's PDS as
tech.waow.pub-search.subscription — portable, inspectable
- local sqlite mirror (new `subscriptions` table) keyed by (owner, rkey)
so match at ingest time is an indexed lookup
- indexer.insertDocument gains a void-returning hook that queries
matching subs and enqueues deliveries on a bounded in-memory queue
(drops when full; never blocks the tap worker)
- a single worker thread drains the queue and sends via
chat.bsky.convo.sendMessage, proxied through the subscriber's PDS
notes:
- sessions are in-memory (ken pattern) so deliveries for users who
haven't signed in since the last backend restart are skipped —
tracked in the skipped_no_session counter
- frontend is served from CF Pages; cross-origin cookies use
SameSite=None; Secure with credentialed CORS back to the backend
- load-bearing paths (search, atlas, tap, reconciler, embedder, sync)
are not touched
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>