claudemesh-cli 1.0.0-alpha.32 → 1.0.0-alpha.34

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.
@@ -88,7 +88,7 @@ __export(exports_urls, {
88
88
  VERSION: () => VERSION,
89
89
  URLS: () => URLS
90
90
  });
91
- var URLS, VERSION = "1.0.0-alpha.32", env;
91
+ var URLS, VERSION = "1.0.0-alpha.34", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -2522,7 +2522,13 @@ class BrokerClient {
2522
2522
  plaintext = `[${event}]`;
2523
2523
  }
2524
2524
  } else if (senderPubkey && nonce && ciphertext) {
2525
- plaintext = await decryptDirect({ nonce, ciphertext }, senderPubkey, this.sessionSecretKey ?? this.mesh.secretKey);
2525
+ const envelope = { nonce, ciphertext };
2526
+ if (this.sessionSecretKey) {
2527
+ plaintext = await decryptDirect(envelope, senderPubkey, this.sessionSecretKey);
2528
+ }
2529
+ if (plaintext === null) {
2530
+ plaintext = await decryptDirect(envelope, senderPubkey, this.mesh.secretKey);
2531
+ }
2526
2532
  }
2527
2533
  if (plaintext === null && ciphertext && !senderPubkey) {
2528
2534
  try {
@@ -9782,8 +9788,10 @@ async function resolveClient(to) {
9782
9788
  };
9783
9789
  }
9784
9790
  const nameLower = target.toLowerCase();
9791
+ const candidates = [];
9785
9792
  for (const c of targetClients) {
9786
9793
  const peers = await c.listPeers();
9794
+ candidates.push({ mesh: c.meshSlug, peers });
9787
9795
  const match = peers.find((p) => p.displayName.toLowerCase() === nameLower);
9788
9796
  if (match)
9789
9797
  return { client: c, targetSpec: match.pubkey };
@@ -9794,13 +9802,11 @@ async function resolveClient(to) {
9794
9802
  return { client: c, targetSpec: partials[0].pubkey };
9795
9803
  }
9796
9804
  }
9797
- if (targetClients.length === 1) {
9798
- return { client: targetClients[0], targetSpec: target };
9799
- }
9805
+ const known = candidates.flatMap((c) => c.peers.map((p) => `${c.mesh}/${p.displayName}`));
9800
9806
  return {
9801
9807
  client: null,
9802
9808
  targetSpec: target,
9803
- error: `peer "${target}" not found in any mesh (joined: ${clients2.map((c) => c.meshSlug).join(", ")})`
9809
+ error: `peer "${target}" not found. ` + (known.length ? `Known peers: ${known.slice(0, 10).join(", ")}${known.length > 10 ? ", …" : ""}` : "No connected peers on your mesh(es). Use pubkey hex, @group, or * for broadcast.")
9804
9810
  };
9805
9811
  }
9806
9812
  async function resolvePeerName(client, pubkey) {
@@ -10156,6 +10162,9 @@ ${manifest.allowed_tools.map((t) => ` - ${t}`).join(`
10156
10162
  sections.push(`${header}
10157
10163
  No peers connected.`);
10158
10164
  } else {
10165
+ const pubkeyCounts = new Map;
10166
+ for (const p of peers)
10167
+ pubkeyCounts.set(p.pubkey, (pubkeyCounts.get(p.pubkey) ?? 0) + 1);
10159
10168
  const peerLines = peers.map((p) => {
10160
10169
  const summary = p.summary ? ` — "${p.summary}"` : "";
10161
10170
  const groupsStr = p.groups?.length ? ` [${p.groups.map((g) => `@${g.name}${g.role ? ":" + g.role : ""}`).join(", ")}]` : "";
@@ -10173,7 +10182,9 @@ No peers connected.`);
10173
10182
  const profileAvatar = p.profile?.avatar ? `${p.profile.avatar} ` : "";
10174
10183
  const profileTitle = p.profile?.title ? ` (${p.profile.title})` : "";
10175
10184
  const hiddenTag = p.visible === false ? " [hidden]" : "";
10176
- return `- ${profileAvatar}**${p.displayName}**${profileTitle} [${p.status}]${localityTag}${hiddenTag}${groupsStr}${metaStr} (${p.pubkey.slice(0, 12)}…)${cwdStr}${summary}`;
10185
+ const sameKeyCount = pubkeyCounts.get(p.pubkey) ?? 1;
10186
+ const sameKeyTag = sameKeyCount > 1 ? ` [shares key with ${sameKeyCount - 1} other session(s)]` : "";
10187
+ return `- ${profileAvatar}**${p.displayName}**${profileTitle} [${p.status}]${localityTag}${hiddenTag}${sameKeyTag}${groupsStr}${metaStr} (${p.pubkey.slice(0, 12)}…)${cwdStr}${summary}`;
10177
10188
  });
10178
10189
  sections.push(`${header}
10179
10190
  ${peerLines.join(`
@@ -12479,4 +12490,4 @@ main().catch((err) => {
12479
12490
  process.exit(EXIT.INTERNAL_ERROR);
12480
12491
  });
12481
12492
 
12482
- //# debugId=E80C818349D554BA64756E2164756E21
12493
+ //# debugId=9FBBACA39D70481964756E2164756E21