libp2p-mesh 2026.5.29 → 2026.5.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,12 +79,13 @@ export function registerLibp2pMesh(api) {
79
79
  mesh.onMessage((msg) => {
80
80
  handleP2PInbound(msg, buildInboundDeps());
81
81
  });
82
- // Dedup: skip identity send if peer is already known
82
+ // Always send our identity when a peer connects. Identity exchange is
83
+ // bidirectional: even if we already know this peer, they may not know
84
+ // our current identity (or theirs may be stale). The receiving side
85
+ // handles dedup via handleIdentityMessage (register only if new or
86
+ // updated). Removing the send-side dedup ensures both sides always
87
+ // have each other's current identity.
83
88
  mesh.onPeerConnect((peerId) => {
84
- if (peerIdentityMap.hasIdentity(peerId)) {
85
- api.logger.debug?.(`[libp2p-mesh] Peer ${peerId} already known, skipping identity send`);
86
- return;
87
- }
88
89
  api.logger.info?.(`[libp2p-mesh] Peer connected: ${peerId} — sending identity`);
89
90
  // Only send identity if relay config is set
90
91
  if (!relayChannel || !relayAccountId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libp2p-mesh",
3
- "version": "2026.5.29",
3
+ "version": "2026.5.30",
4
4
  "description": "OpenClaw libp2p P2P mesh network plugin for cross-instance agent communication",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/plugin.ts CHANGED
@@ -94,12 +94,13 @@ export function registerLibp2pMesh(api: OpenClawPluginApi) {
94
94
  handleP2PInbound(msg, buildInboundDeps());
95
95
  });
96
96
 
97
- // Dedup: skip identity send if peer is already known
97
+ // Always send our identity when a peer connects. Identity exchange is
98
+ // bidirectional: even if we already know this peer, they may not know
99
+ // our current identity (or theirs may be stale). The receiving side
100
+ // handles dedup via handleIdentityMessage (register only if new or
101
+ // updated). Removing the send-side dedup ensures both sides always
102
+ // have each other's current identity.
98
103
  mesh.onPeerConnect((peerId: string) => {
99
- if (peerIdentityMap.hasIdentity(peerId)) {
100
- api.logger.debug?.(`[libp2p-mesh] Peer ${peerId} already known, skipping identity send`);
101
- return;
102
- }
103
104
  api.logger.info?.(`[libp2p-mesh] Peer connected: ${peerId} — sending identity`);
104
105
  // Only send identity if relay config is set
105
106
  if (!relayChannel || !relayAccountId) return;