From 4afe365c003b8842a86b4ad1a6e7a55a26ca382e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:45:40 +0100 Subject: [PATCH] =?UTF-8?q?fix(cli):=20v0.1.12=20=E2=80=94=20resolve=20sen?= =?UTF-8?q?der=20display=20name=20in=20push=20notifications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onPush now queries list_peers to resolve the sender's pubkey to their display name. Instructions updated to tell Claude to reply by name instead of raw pubkey. Fixes two-way messaging between named peers. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/cli/package.json | 2 +- apps/cli/src/mcp/server.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/cli/package.json b/apps/cli/package.json index c864375..c7d5109 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -1,6 +1,6 @@ { "name": "claudemesh-cli", - "version": "0.1.11", + "version": "0.1.12", "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.", "keywords": [ "claude-code", diff --git a/apps/cli/src/mcp/server.ts b/apps/cli/src/mcp/server.ts index b668e93..6db3cea 100644 --- a/apps/cli/src/mcp/server.ts +++ b/apps/cli/src/mcp/server.ts @@ -122,7 +122,7 @@ export async function startMcpServer(): Promise { IMPORTANT: When you receive a message, RESPOND IMMEDIATELY. Do not wait until your current task is finished. Pause what you are doing, reply to the message using send_message, then resume your work. Treat incoming peer messages like a coworker tapping you on the shoulder — answer right away, even if you're in the middle of something. -Read the from_id, from_name, mesh_slug, and priority attributes to understand context. Reply by calling send_message with the same target (for direct messages the from_id is the sender's pubkey). +Read the from_id, from_name, mesh_slug, and priority attributes to understand context. Reply by calling send_message with to set to the from_name (display name) of the sender. Available tools: - list_peers: see joined meshes + their connection status @@ -251,9 +251,17 @@ If you have multiple joined meshes, prefix the \`to\` argument of send_message w for (const client of allClients()) { client.onPush(async (msg) => { const fromPubkey = msg.senderPubkey || ""; - const fromName = fromPubkey + // Resolve sender's display name from the peer list. + let fromName = fromPubkey ? `peer-${fromPubkey.slice(0, 8)}` : "unknown"; + try { + const peers = await client.listPeers(); + const match = peers.find((p) => p.pubkey === fromPubkey); + if (match) fromName = match.displayName; + } catch { + /* best effort — fall back to truncated pubkey */ + } const content = msg.plaintext ?? decryptFailedWarning(fromPubkey); try { await server.notification({