libp2p-mesh 2026.5.21 → 2026.5.22

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.
@@ -184,6 +184,7 @@ export declare function buildP2PTools(mesh: MeshNetwork): ({
184
184
  }[];
185
185
  details: {
186
186
  peers: {
187
+ peerId: string;
187
188
  instanceId: any;
188
189
  channel: any;
189
190
  }[];
@@ -171,14 +171,15 @@ export function buildP2PTools(mesh) {
171
171
  const ch = identity.channel ? ` (${identity.channel})` : "";
172
172
  return ` - ${identity.instanceId}${ch}`;
173
173
  }
174
- return ` - ${p.slice(0, 12)}... (identity unknown)`;
174
+ return ` - ${identity?.instanceId || p} (identity unknown)`;
175
175
  })
176
176
  .join("\n");
177
177
  const text = `在线用户 (${peers.length}):\n${userList}`;
178
178
  const safePeers = peers.map((p) => {
179
179
  const identity = peerIdentityMap?.resolve(p);
180
180
  return {
181
- instanceId: identity?.instanceId || p.slice(0, 12) + "...",
181
+ peerId: p,
182
+ instanceId: identity?.instanceId || p,
182
183
  channel: identity?.channel || "unknown",
183
184
  };
184
185
  });
@@ -306,7 +307,7 @@ export function buildP2PTools(mesh) {
306
307
  // Format output
307
308
  const lines = [];
308
309
  lines.push(`P2P Mesh Identity Table`);
309
- lines.push(`Local: ${localPeerId.slice(0, 16)}... | Instance: ${localInstanceId}`);
310
+ lines.push(`Local: ${localPeerId} | Instance: ${localInstanceId}`);
310
311
  lines.push(`Connected: ${connectedPeers.length} | Known total: ${allPeers.length}`);
311
312
  lines.push("");
312
313
  if (allPeers.length === 0) {
@@ -314,9 +315,8 @@ export function buildP2PTools(mesh) {
314
315
  }
315
316
  else {
316
317
  for (const p of allPeers) {
317
- const shortId = p.peerId.slice(0, 16) + "...";
318
318
  const time = p.lastSeen ? new Date(p.lastSeen).toLocaleTimeString() : "unknown";
319
- lines.push(` [${p.status}] ${shortId}`);
319
+ lines.push(` [${p.status}] ${p.peerId}`);
320
320
  lines.push(` Agent: ${p.agentId} | Channel: ${p.channel}`);
321
321
  lines.push(` Instance: ${p.instanceId ?? "unknown"}`);
322
322
  lines.push(` Last seen: ${time}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libp2p-mesh",
3
- "version": "2026.5.21",
3
+ "version": "2026.5.22",
4
4
  "description": "OpenClaw libp2p P2P mesh network plugin for cross-instance agent communication",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -172,14 +172,15 @@ export function buildP2PTools(mesh: MeshNetwork) {
172
172
  const ch = identity.channel ? ` (${identity.channel})` : "";
173
173
  return ` - ${identity.instanceId}${ch}`;
174
174
  }
175
- return ` - ${p.slice(0, 12)}... (identity unknown)`;
175
+ return ` - ${identity?.instanceId || p} (identity unknown)`;
176
176
  })
177
177
  .join("\n");
178
178
  const text = `在线用户 (${peers.length}):\n${userList}`;
179
179
  const safePeers = peers.map((p) => {
180
180
  const identity = peerIdentityMap?.resolve(p);
181
181
  return {
182
- instanceId: identity?.instanceId || p.slice(0, 12) + "...",
182
+ peerId: p,
183
+ instanceId: identity?.instanceId || p,
183
184
  channel: identity?.channel || "unknown",
184
185
  };
185
186
  });
@@ -308,7 +309,7 @@ export function buildP2PTools(mesh: MeshNetwork) {
308
309
  // Format output
309
310
  const lines: string[] = [];
310
311
  lines.push(`P2P Mesh Identity Table`);
311
- lines.push(`Local: ${localPeerId.slice(0, 16)}... | Instance: ${localInstanceId}`);
312
+ lines.push(`Local: ${localPeerId} | Instance: ${localInstanceId}`);
312
313
  lines.push(`Connected: ${connectedPeers.length} | Known total: ${allPeers.length}`);
313
314
  lines.push("");
314
315
 
@@ -316,9 +317,8 @@ export function buildP2PTools(mesh: MeshNetwork) {
316
317
  lines.push("(no known peers yet)");
317
318
  } else {
318
319
  for (const p of allPeers) {
319
- const shortId = p.peerId.slice(0, 16) + "...";
320
320
  const time = p.lastSeen ? new Date(p.lastSeen).toLocaleTimeString() : "unknown";
321
- lines.push(` [${p.status}] ${shortId}`);
321
+ lines.push(` [${p.status}] ${p.peerId}`);
322
322
  lines.push(` Agent: ${p.agentId} | Channel: ${p.channel}`);
323
323
  lines.push(` Instance: ${p.instanceId ?? "unknown"}`);
324
324
  lines.push(` Last seen: ${time}`);