mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
Kind 20001 is claimed by both BitChat's GeohashPresenceEvent and Buzz's PresenceUpdateEvent. EventFactory's flat when(kind) could only route one, so Buzz presence never materialized (parsed as a geohash event) in either direction — this was the deferred "EventFactory collision". Disambiguate inside the shared 20001 branch by BitChat's required `g` (geohash) tag: present -> GeohashPresenceEvent, absent -> PresenceUpdateEvent. Verified against the Buzz Rust ground truth (buzz-sdk build_presence_update + the relay's synthesize_presence read form): Buzz presence carries the status in content plus a `status` tag (client) or a `p` tag (relay-synthesized), never a `g` tag, and BitChat presence always carries `g` with empty content. Both inbound parse (EventDeserializer) and outbound signing (EventAssembler) route through this factory, so one guard fixes both. Make it usable, not just parseable: add BuzzPresenceState (process-wide latest online/away/offline per subject, mirroring BuzzTypingState), a PresenceUpdateEvent.subjectPubKey() accessor (the `p` tag or the author), and a LocalCache branch that records presence and drops the ephemeral without storing it. Tests cover both Buzz wire shapes, the BitChat guard, and latest-wins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8KBSw6smQRyXLiWHeDsZ8