Files
amethyst/quartz/src
Claude 2ebbba4fe9 feat(relay): attach human-readable reasons to relay subscriptions
Every relay subscription now carries a short, client-side "reason" string
explaining why it is open (e.g. "Your private messages", "Notifications",
"Home feed", "Your Concord groups"). The always-on notification service uses
these to show not just HOW MANY relay connections are established, but WHAT
each one is doing.

Mechanism:
- quartz: `Subscription` gains a `reason` field, threaded through
  `SubscriptionController` into `INostrClient.subscribe(..., reason)`.
  `NostrClient` keeps a `subscriptionReasonsFlow()` (subId -> reason),
  populated on subscribe and pruned on unsubscribe, so it mirrors exactly
  the subscriptions actively sending REQs to relays.
- commons: `BaseEoseManager` exposes an overridable `subscriptionReason`;
  when unset it falls back to a humanized class name, so every subscription
  is labeled even without an explicit override.
- Headline managers (DMs, notifications, account info, drafts, home, video,
  discovery, profile, hashtag, community, Concord/relay groups, NWC, Cashu,
  search, finders, secure groups) declare friendly labels.
- NotificationRelayService combines the connected-relay count with the
  grouped reasons and renders them via InboxStyle (identical reasons collapse
  to "reason xN", overflow folds into a "+N more" line). The collapsed view
  is unchanged.

The reason is purely an in-app diagnostic label; it never reaches relays (a
REQ still carries only the subId and filters).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EyFmjFs1KUe2PUQHxkbRP1
2026-07-24 01:11:01 +00:00
..