Files
amethyst/commons
Claude 87dd8ee2ec feat(audio-rooms): RoomPresence + aggregator for listener-side fan-in
Introduces the data model + in-memory dedup/eviction logic the
participant grid (Tier 2 #1), hand-raise queue (T1 #5), and listener
counter (T1 #8) all consume.

  RoomPresence       — one peer's most recent kind-10312 snapshot.
                       Equality is by pubkey alone so a Set or Map
                       swap on heartbeat update doesn't double-count
                       when only the timestamp changes.
                       `RoomPresence.from(event)` projects every
                       presence tag, with conservative defaults for
                       absent ones (handRaised/publishing default
                       false; muted stays null to distinguish "didn't
                       say" from "explicitly false"; onstage defaults
                       TRUE so pre-onstage clients still render as
                       speakers).

  RoomPresenceAggregator
                     — `apply(event)` dedupes by pubkey, keeps the
                       most recent createdAt (out-of-order events
                       can't overwrite newer state). `evictOlderThan`
                       is the staleness sweep — caller drives the
                       cadence (typically a 60 s tick passing
                       `now - 6*60` to evict on >6 min of silence).

Tests cover: tag projection, the absent-tag defaults, dedup on same
pubkey, out-of-order non-overwrite, multi-pubkey isolation, eviction
window, and the pubkey-only equality contract.

The amethyst-side LocalCache wiring + listener-counter UI come next
in their own commit.
2026-04-26 21:42:11 +00:00
..