claudemesh-cli 1.16.0 → 1.17.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.
@@ -88,7 +88,7 @@ __export(exports_urls, {
88
88
  VERSION: () => VERSION,
89
89
  URLS: () => URLS
90
90
  });
91
- var URLS, VERSION = "1.16.0", env;
91
+ var URLS, VERSION = "1.17.0", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -6698,18 +6698,27 @@ function projectFields(record, fields) {
6698
6698
  return out;
6699
6699
  }
6700
6700
  async function listPeersForMesh(slug) {
6701
+ const config = readConfig();
6702
+ const joined = config.meshes.find((m) => m.slug === slug);
6703
+ const selfMemberPubkey = joined?.pubkey ?? null;
6701
6704
  const bridged = await tryBridge(slug, "peers");
6702
6705
  if (bridged && bridged.ok) {
6703
- return bridged.result;
6706
+ const peers = bridged.result;
6707
+ return peers.map((p) => annotateSelf(p, selfMemberPubkey, null));
6704
6708
  }
6705
6709
  let result = [];
6706
6710
  await withMesh({ meshSlug: slug }, async (client) => {
6707
6711
  const all = await client.listPeers();
6708
- const selfPubkey = client.getSessionPubkey();
6709
- result = selfPubkey ? all.filter((p) => p.pubkey !== selfPubkey) : all;
6712
+ const selfSessionPubkey = client.getSessionPubkey();
6713
+ result = all.map((p) => annotateSelf(p, selfMemberPubkey, selfSessionPubkey));
6710
6714
  });
6711
6715
  return result;
6712
6716
  }
6717
+ function annotateSelf(peer, selfMemberPubkey, selfSessionPubkey) {
6718
+ const isSelf = !!(selfMemberPubkey && peer.memberPubkey && peer.memberPubkey === selfMemberPubkey);
6719
+ const isThisSession = !!(isSelf && selfSessionPubkey && peer.pubkey === selfSessionPubkey);
6720
+ return { ...peer, isSelf, isThisSession };
6721
+ }
6713
6722
  async function runPeers(flags) {
6714
6723
  const config = readConfig();
6715
6724
  const slugs = flags.mesh ? [flags.mesh] : config.meshes.map((m) => m.slug);
@@ -6748,7 +6757,8 @@ async function runPeers(flags) {
6748
6757
  const metaStr = meta.length ? dim(` (${meta.join(", ")})`) : "";
6749
6758
  const summary = p.summary ? dim(` — ${p.summary}`) : "";
6750
6759
  const pubkeyTag = dim(` · ${p.pubkey.slice(0, 16)}…`);
6751
- render.info(`${statusDot} ${name}${groups}${metaStr}${pubkeyTag}${summary}`);
6760
+ const selfTag = p.isThisSession ? dim(" ") + yellow("(this session)") : p.isSelf ? dim(" ") + yellow("(your other session)") : "";
6761
+ render.info(`${statusDot} ${name}${selfTag}${groups}${metaStr}${pubkeyTag}${summary}`);
6752
6762
  if (p.cwd)
6753
6763
  render.info(dim(` cwd: ${p.cwd}`));
6754
6764
  }
@@ -6786,6 +6796,14 @@ async function runSend(flags, to, message) {
6786
6796
  const priority = flags.priority === "now" ? "now" : flags.priority === "low" ? "low" : "next";
6787
6797
  const config = readConfig();
6788
6798
  const meshSlug = flags.mesh ?? (config.meshes.length === 1 ? config.meshes[0].slug : null);
6799
+ if (!flags.self && meshSlug) {
6800
+ const joined = config.meshes.find((m) => m.slug === meshSlug);
6801
+ if (joined && /^[0-9a-f]{64}$/i.test(to) && to.toLowerCase() === joined.pubkey.toLowerCase()) {
6802
+ render.err(`Target "${to.slice(0, 16)}…" is your own member pubkey on mesh "${meshSlug}".`);
6803
+ render.hint("Pass --self to message a sibling session of your own member, or pick a different peer's pubkey.");
6804
+ process.exit(1);
6805
+ }
6806
+ }
6789
6807
  if (meshSlug) {
6790
6808
  const bridged = await tryBridge(meshSlug, "send", { to, message, priority });
6791
6809
  if (bridged !== null) {
@@ -14538,7 +14556,7 @@ async function main() {
14538
14556
  }
14539
14557
  case "send": {
14540
14558
  const { runSend: runSend2 } = await Promise.resolve().then(() => (init_send(), exports_send));
14541
- await runSend2({ mesh: flags.mesh, priority: flags.priority, json: !!flags.json }, positionals[0] ?? "", positionals.slice(1).join(" "));
14559
+ await runSend2({ mesh: flags.mesh, priority: flags.priority, json: !!flags.json, self: !!flags.self }, positionals[0] ?? "", positionals.slice(1).join(" "));
14542
14560
  break;
14543
14561
  }
14544
14562
  case "inbox": {
@@ -15297,4 +15315,4 @@ main().catch((err) => {
15297
15315
  process.exit(EXIT.INTERNAL_ERROR);
15298
15316
  });
15299
15317
 
15300
- //# debugId=BDE3C231AF7C585064756E2164756E21
15318
+ //# debugId=E54B2ED5C4F2639E64756E2164756E21