Files
modules/pear-platform/hyper-pear-update-gossip
Raven ScottandCursor 5a24a4eec8 Expand collab, network-stack, messaging, storage, pear, and experimental modules
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]>
2026-05-21 02:56:47 -04:00
..
2026-05-20 22:56:32 -04:00
2026-05-21 00:07:44 -04:00
2026-05-20 21:57:50 -04:00
2026-05-20 21:57:50 -04:00
2026-05-20 23:36:32 -04:00

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 manifest or empty version on publishUpdate.
  • subscribe(fn): fn must be a function.

Composition

  • Manifest often matches hyper-bare-bundle-bridge resolve output.
  • Multisig gate: hyper-p2p-multisig-threshold before publishUpdate.
  • String version compare—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()