feat(routing,collab,trust): manually expand sticky-session and collab modules
Hyper-P2P Module Tests / unit-all (push) Has been cancelled

- sticky-session: unbind, listSessions, bindBatch, remote remove gossip
- cursor-presence: peersInDoc, pruneStale
- whiteboard-op: listRooms, opCount, pruneRoom
- key-rotation: listActiveKeys, revoke, tick activation sweep

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 02:19:01 -04:00
co-authored by Cursor
parent cd048cb8c8
commit 3de911fc2e
4 changed files with 83 additions and 2 deletions
@@ -32,9 +32,40 @@ class HyperP2PStickySession extends EventEmitter {
return this._bindings.get(sessionId) || null
}
unbind (sessionId) {
assertNonEmpty(sessionId, 'sessionId')
const ok = this._bindings.delete(sessionId)
if (ok) {
gossipSend(this, { type: 'sticky-session-remove', sessionId })
this._stats.gossipOut++
}
return ok
}
hasSession (sessionId) {
return this._bindings.has(sessionId)
}
listSessions () {
return [...this._bindings.entries()].map(([sessionId, peerId]) => ({ sessionId, peerId }))
}
bindBatch (pairs) {
if (!Array.isArray(pairs)) throw new Error('pairs must be an array')
let n = 0
for (const p of pairs) {
if (p && this.bind(p.sessionId, p.peerId)) n++
}
return n
}
_onGossip (d) {
if (!d || d.type !== 'sticky-session-sync' || !d.sessionId) return
this._stats.gossipIn++
if (d.type === 'sticky-session-remove') {
this._bindings.delete(d.sessionId)
return
}
if (d.peerId) this._bindings.set(d.sessionId, d.peerId)
}