Add manual helpers: overlay topology neighbor management, stream chunker drainAll, whiteboard and line-lock clear, fork picker and cursor presence bulk ops, anycast unregister, bandwidth broker reset, log gossip filtering, bee tombstone clear, gossip mesh clearSeen, update gossip unsubscribeAll, congestion throttled peers, histogram reset, preflight cancelAll, sticky session clearAll, gravity well and collab room bulk helpers, stream resume reset, stream transform clearPending, entropy spiral advanceBatch, and related list/clear utilities. Co-authored-by: Cursor <[email protected]>
hyper-pear-update-gossip
Publish Pear app updates (version + manifest); keep lexicographically greatest version as latest; notify subscribers.
Category: pear-platform · Protocol: pear-update-gossip/v1 · Exports: HyperPearUpdateGossip, HyperP2PPearUpdateGossip, PROTOCOL
When to use
Mesh-wide “latest build” discovery for Pear apps.
When not to use
Semver-aware updates (versions compared as strings with >).
Quick start
const { HyperPearUpdateGossip } = require('hyper-pear-update-gossip')
const gossip = new HyperPearUpdateGossip({ topic: 'updates' })
await gossip.ready()
gossip.publishUpdate('1.0.1', { url: 'pear://bundle/app' })
console.log(gossip.latestUpdate())
await gossip.close()
Docs
Test
npm test
API
| Member | Description |
|---|---|
new HyperPearUpdateGossip(opts?) |
topic, keyPair. |
publishUpdate(version, manifest) |
manifest object; updates _latest if version greater. |
latestUpdate() |
Copy of latest or null. |
subscribe(fn) |
Called immediately with latest if present; returns unsubscribe. |
getStats() |
{ published, gossipIn, gossipOut, subscribers, hasLatest, protocol }. |
ready() / close() |
Clears subscribers on close. |
Events: update, closed. Also invokes subscriber callbacks on new latest.
Architecture
_latest: { version, manifest, publishedAt } | null
_subs: Set<fn>
Gossip update-publish: adopt if d.version > _latest.version (string compare)
Use zero-padded numeric versions if ordering matters ("009" vs "10").
Wire table
type |
Fields | Direction |
|---|---|---|
update-publish |
version, manifest, publishedAt |
Any → all |
Errors
- Non-object
manifestor emptyversiononpublishUpdate. subscribe(fn):fnmust be a function.
Composition
- Manifest often matches
hyper-bare-bundle-bridgeresolve output. - Multisig gate:
hyper-p2p-multisig-thresholdbeforepublishUpdate. - String
versioncompare—use fixed-width numeric strings if needed.
Example
const { HyperPearUpdateGossip } = require('hyper-pear-update-gossip')
const gossip = new HyperPearUpdateGossip({ topic: process.argv[2] })
const unsub = gossip.subscribe((u) => console.log('latest', u.version))
await gossip.ready()
gossip.publishUpdate('1.0.1', { url: 'pear://bundle/app' })
console.log(gossip.latestUpdate())
unsub()
await gossip.close()