claudemesh-cli 1.36.0 → 1.37.0

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.
@@ -104,7 +104,7 @@ __export(exports_urls, {
104
104
  VERSION: () => VERSION,
105
105
  URLS: () => URLS
106
106
  });
107
- var URLS, VERSION = "1.36.0", env;
107
+ var URLS, VERSION = "1.37.0", env;
108
108
  var init_urls = __esm(() => {
109
109
  URLS = {
110
110
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -8198,12 +8198,12 @@ async function runPeers(flags) {
8198
8198
  for (const slug of slugs) {
8199
8199
  try {
8200
8200
  const peers = await listPeersForMesh(slug);
8201
+ const visible = flags.all ? peers : peers.filter((p) => p.peerRole !== "control-plane");
8201
8202
  if (wantsJson) {
8202
- const projected = fieldList ? peers.map((p) => projectFields(p, fieldList)) : peers;
8203
+ const projected = fieldList ? visible.map((p) => projectFields(p, fieldList)) : visible;
8203
8204
  allJson.push({ mesh: slug, peers: projected });
8204
8205
  continue;
8205
8206
  }
8206
- const visible = flags.all ? peers : peers.filter((p) => p.peerRole !== "control-plane");
8207
8207
  const sorted = visible.slice().sort((a, b) => {
8208
8208
  const score = (p) => p.isThisSession ? 0 : p.isSelf ? 1 : 2;
8209
8209
  return score(a) - score(b);
@@ -8294,6 +8294,8 @@ async function runSend(flags, to, message) {
8294
8294
  continue;
8295
8295
  daemonReachable2 = true;
8296
8296
  for (const p of peers) {
8297
+ if (p.peerRole === "control-plane")
8298
+ continue;
8297
8299
  const pk = (p.pubkey ?? "").toLowerCase();
8298
8300
  const mpk = (p.memberPubkey ?? "").toLowerCase();
8299
8301
  const dn = p.displayName ?? "?";
@@ -8355,7 +8357,7 @@ async function runSend(flags, to, message) {
8355
8357
  return false;
8356
8358
  if (ownSessionPk && r.pubkey.toLowerCase() === ownSessionPk)
8357
8359
  return false;
8358
- if (r.channel === "claudemesh-daemon")
8360
+ if (r.peerRole === "control-plane" || r.channel === "claudemesh-daemon")
8359
8361
  return false;
8360
8362
  return r.memberPubkey?.toLowerCase() === to.toLowerCase();
8361
8363
  });
@@ -8402,14 +8404,40 @@ async function runSend(flags, to, message) {
8402
8404
  }
8403
8405
  }
8404
8406
  }
8407
+ if (flags.self) {
8408
+ render.warn("--self had no effect: it only applies when the target is your own member pubkey (fan-out to your sibling sessions). Sending to this specific pubkey directly.");
8409
+ }
8410
+ let recipientOnline = null;
8411
+ let recipientName;
8412
+ if (isDirect && meshSlug) {
8413
+ const { tryListPeersViaDaemon: tryListPeersViaDaemon2 } = await Promise.resolve().then(() => (init_daemon_route(), exports_daemon_route));
8414
+ const peers = await tryListPeersViaDaemon2(meshSlug);
8415
+ if (peers !== null) {
8416
+ const lower = to.toLowerCase();
8417
+ const match = peers.find((p) => {
8418
+ const r = p;
8419
+ if (r.peerRole === "control-plane")
8420
+ return false;
8421
+ return r.pubkey?.toLowerCase() === lower || r.memberPubkey?.toLowerCase() === lower;
8422
+ });
8423
+ recipientOnline = !!match;
8424
+ recipientName = match ? match.displayName : undefined;
8425
+ }
8426
+ }
8427
+ const offlineHint = "Session pubkeys are ephemeral — a key from an ended session never reconnects, so the message can't be delivered. Re-fetch a live target with `claudemesh peer list --json`.";
8405
8428
  {
8406
8429
  const dr = await trySendViaDaemon({ to, message, priority, expectedMesh: meshSlug ?? undefined });
8407
8430
  if (dr !== null) {
8408
8431
  if (dr.ok) {
8409
- if (flags.json)
8410
- console.log(JSON.stringify({ ok: true, messageId: dr.messageId, target: to, via: "daemon", duplicate: !!dr.duplicate }));
8411
- else
8412
- render.ok(`sent to ${to} (daemon)`, dr.messageId ? dim(dr.messageId.slice(0, 8)) : undefined);
8432
+ if (flags.json) {
8433
+ console.log(JSON.stringify({ ok: true, messageId: dr.messageId, target: to, via: "daemon", duplicate: !!dr.duplicate, status: dr.status, recipientOnline }));
8434
+ } else if (recipientOnline === false) {
8435
+ render.warn(`queued for ${recipientName ?? to.slice(0, 16) + "…"} — no connected peer matches this key on "${meshSlug}".`);
8436
+ render.hint(offlineHint);
8437
+ } else {
8438
+ const who = recipientName ? `${recipientName} (${to.slice(0, 16)}…)` : to;
8439
+ render.ok(`sent to ${who}${recipientOnline === true ? " (online)" : " (daemon)"}`, dr.messageId ? dim(dr.messageId.slice(0, 8)) : undefined);
8440
+ }
8413
8441
  return;
8414
8442
  }
8415
8443
  if (flags.json)
@@ -8444,9 +8472,13 @@ async function runSend(flags, to, message) {
8444
8472
  const result = await client.send(targetSpec, message, priority);
8445
8473
  if (result.ok) {
8446
8474
  if (flags.json) {
8447
- console.log(JSON.stringify({ ok: true, messageId: result.messageId, target: to }));
8475
+ console.log(JSON.stringify({ ok: true, messageId: result.messageId, target: to, recipientOnline }));
8476
+ } else if (recipientOnline === false) {
8477
+ render.warn(`queued for ${recipientName ?? to} — no connected peer matches this key on "${meshSlug ?? flags.mesh ?? "default"}".`);
8478
+ render.hint(offlineHint);
8448
8479
  } else {
8449
- render.ok(`sent to ${to}`, result.messageId ? dim(result.messageId.slice(0, 8)) : undefined);
8480
+ const who = recipientName ? `${recipientName} (${to.slice(0, 16)}…)` : to;
8481
+ render.ok(`sent to ${who}${recipientOnline === true ? " (online)" : ""}`, result.messageId ? dim(result.messageId.slice(0, 8)) : undefined);
8450
8482
  }
8451
8483
  } else {
8452
8484
  if (flags.json) {
@@ -11703,13 +11735,23 @@ class SessionBrokerClient {
11703
11735
  sessionPubkey: this.opts.sessionPubkey,
11704
11736
  sessionSecretKey: this.opts.sessionSecretKey
11705
11737
  });
11738
+ let parentAttestation = this.opts.parentAttestation;
11739
+ try {
11740
+ parentAttestation = await signParentAttestation({
11741
+ parentMemberPubkey: this.opts.mesh.pubkey,
11742
+ parentSecretKey: this.opts.mesh.secretKey,
11743
+ sessionPubkey: this.opts.sessionPubkey
11744
+ });
11745
+ } catch (e) {
11746
+ this.log("warn", "parent attestation re-mint failed; reusing stored token (may be expired)", { err: String(e) });
11747
+ }
11706
11748
  return {
11707
11749
  type: "session_hello",
11708
11750
  meshId: this.opts.mesh.meshId,
11709
11751
  parentMemberId: this.opts.mesh.memberId,
11710
11752
  parentMemberPubkey: this.opts.mesh.pubkey,
11711
11753
  sessionPubkey: this.opts.sessionPubkey,
11712
- parentAttestation: this.opts.parentAttestation,
11754
+ parentAttestation,
11713
11755
  displayName: this.opts.displayName,
11714
11756
  sessionId: this.opts.sessionId,
11715
11757
  pid: this.opts.pid,
@@ -21651,4 +21693,4 @@ main().catch((err) => {
21651
21693
  process.exit(EXIT.INTERNAL_ERROR);
21652
21694
  });
21653
21695
 
21654
- //# debugId=0CB1BFC94A895DDD64756E2164756E21
21696
+ //# debugId=2228CF546341C88264756E2164756E21