fix(guild): live roster gossip and reliable mesh send (v0.1.1)

- GUILD_SYNC consumers receive members[] from platform bundle builder
- Dedupe hyperswarm connections per peerId before attaching gossip/attach wires
- broadcastGossip: bounded wireReady then always send (matches discovery mesh)

Enables live MEMBER_JOIN, MEMBER_ROLE_UPDATE, and PRESENCE_UPDATE without
simulateGossip in CI smokes.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-22 01:42:30 -04:00
co-authored by Cursor
parent f2762a9d5b
commit 9e5572d402
3 changed files with 14 additions and 3 deletions
+12
View File
@@ -653,6 +653,18 @@ class PearcordGuild extends EventEmitter {
this.swarm.removeAllListeners('connection')
this.swarm.on('connection', (conn) => {
const peerId = b4a.toString(conn.remotePublicKey, 'hex')
const prevConn = this.peers.get(peerId)
if (prevConn && prevConn !== conn) {
try {
prevConn.destroy()
} catch {
// ignore
}
this._channels.delete(peerId)
this._attachChannels.delete(peerId)
this._voiceChannels.delete(peerId)
this._screenChannels.delete(peerId)
}
this.peers.set(peerId, conn)
const ch = attachGossipMesh(this, conn)
if (ch) this._channels.set(peerId, ch)
+1 -2
View File
@@ -33,8 +33,7 @@ async function broadcastGossip (guild, method, payload) {
await Promise.all(
sessions.map(async (session) => {
try {
const ok = await wireReady(session, 6000)
if (!ok) return
await wireReady(session, 2000)
session.send(buf)
} catch {
// peer gone
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pearcord-guild",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.js",
"type": "commonjs",
"exports": {