| … | … | @@ -859,7 +859,7 @@ export class SwarmDevice { |
| 859 | 859 | try { |
| 860 | 860 | let netRev = null |
| 861 | 861 | if (this.firehose) { const h = commitLine(Object.values(await this.sb.listNow(FIREHOSE_PREFIX)).filter((f) => f && f.rev)).head; netRev = h ? h.rev : null } |
| 862 | return { netRev, withHead: this.sb.signerState(undefined, netRev), noHead: this.sb.signerState() } | |
| 862 | return { netRev, withHead: this.sb.signerState(undefined, netRev), noHead: this.sb.signerState(), presence: this.sb.presenceDiag ? this.sb.presenceDiag() : null } | |
| 863 | 863 | } catch { return null } |
| 864 | 864 | })(), |
| 865 | 865 | indexers: (this.sb.base && this.sb.base.linearizer && this.sb.base.linearizer.indexers) ? this.sb.base.linearizer.indexers.length : null, |
| … | … | @@ -1,6 +1,6 @@ |
| 1 | 1 | { |
| 2 | 2 | "name": "hyper-proto-peer", |
| 3 | "version": "0.3.133", | |
| 3 | "version": "0.3.134", | |
| 4 | 4 | "description": "Self-custody, P2P-native atproto peer \u2014 holds the user's key + content as Hypercores and authors+signs its own repo. The source of truth in the peer/bridge split (Model B); atproto-bridge projects it to bsky.", |
| 5 | 5 | "type": "module", |
| 6 | 6 | "main": "lib/peer.js", |
| … | … | @@ -59,6 +59,15 @@ test('state() reports the election with and without the network head, and isSign |
| 59 | 59 | t.alike(s.election.withHead.heads, { A: null, B: h.rev }, 'with each co-owner\'s known head') |
| 60 | 60 | }) |
| 61 | 61 | |
| 62 | test('state().election carries the substrate\'s presence attach/receive counts', async (t) => { | |
| 63 | const sb = new MemKV() | |
| 64 | const A = new SwarmDevice(sb, { did: DID, privateKey: KEY, self: 'A', firehose: true }) | |
| 65 | sb.signerState = () => ({ self: 'A', signer: 'A', effective: ['A'], holds: true, heads: {} }) | |
| 66 | sb.presenceDiag = () => ({ attached: 3, duplicate: 1, received: 0, peers: {} }) | |
| 67 | const s = await A.state() | |
| 68 | t.alike(s.election.presence, { attached: 3, duplicate: 1, received: 0, peers: {} }) | |
| 69 | }) | |
| 70 | ||
| 62 | 71 | test('a substrate with no election (single writer) signs — the same default as sign()', async (t) => { |
| 63 | 72 | const A = new SwarmDevice(new MemKV(), { did: DID, privateKey: KEY, self: 'A', firehose: true }) |
| 64 | 73 | t.is(await A.isSigner(), true) |