claudemesh-cli 1.34.9 → 1.34.10

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.34.9", env;
107
+ var URLS, VERSION = "1.34.10", env;
108
108
  var init_urls = __esm(() => {
109
109
  URLS = {
110
110
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -4339,7 +4339,7 @@ async function ensureDaemonRunning(meshSlug, quiet) {
4339
4339
  render.ok(`daemon ready (${res.durationMs}ms)`);
4340
4340
  return;
4341
4341
  }
4342
- render.warn(`daemon ${res.state}${res.reason ? `: ${res.reason}` : ""}`, "Run `claudemesh daemon up --mesh " + meshSlug + "` manually, then re-launch.");
4342
+ render.warn(`daemon ${res.state}${res.reason ? `: ${res.reason}` : ""}`, "Run `claudemesh daemon up` manually, then re-launch.");
4343
4343
  }
4344
4344
  async function warnIfDaemonStale(quiet) {
4345
4345
  if (quiet)
@@ -4353,7 +4353,7 @@ async function warnIfDaemonStale(quiet) {
4353
4353
  const daemonVersion = res.body.daemon_version ?? "";
4354
4354
  if (!daemonVersion || daemonVersion === VERSION2)
4355
4355
  return;
4356
- render.warn(`daemon is ${daemonVersion}, CLI is ${VERSION2} — restart to pick up new fixes.`, "Run: `claudemesh daemon down && claudemesh daemon up` (or restart the launchd / systemd-user unit).");
4356
+ render.warn(`daemon is ${daemonVersion}, CLI is ${VERSION2} — restart to pick up new fixes.`, "Run: `claudemesh daemon down && claudemesh daemon up` (no --mesh — daemon attaches to every joined mesh; restart the launchd / systemd-user unit if you installed one).");
4357
4357
  } catch {}
4358
4358
  }
4359
4359
  function parseGroupsString(raw) {
@@ -9719,7 +9719,29 @@ function writeSse(res, e, idCounter) {
9719
9719
 
9720
9720
  `);
9721
9721
  }
9722
- function bindSseStream(res, bus) {
9722
+ function shouldDeliver(e, f) {
9723
+ if (!f.sessionPubkey && !f.memberPubkey && !f.meshSlug)
9724
+ return true;
9725
+ if (f.meshSlug) {
9726
+ const eventMesh = typeof e.data.mesh === "string" ? e.data.mesh : null;
9727
+ if (eventMesh && eventMesh !== f.meshSlug)
9728
+ return false;
9729
+ }
9730
+ if (e.kind !== "message")
9731
+ return true;
9732
+ const recipientKind = typeof e.data.recipient_kind === "string" ? e.data.recipient_kind : null;
9733
+ const recipientPubkey = typeof e.data.recipient_pubkey === "string" ? e.data.recipient_pubkey.toLowerCase() : null;
9734
+ if (!recipientKind || !recipientPubkey)
9735
+ return true;
9736
+ if (recipientKind === "session") {
9737
+ return !!f.sessionPubkey && f.sessionPubkey.toLowerCase() === recipientPubkey;
9738
+ }
9739
+ if (recipientKind === "member") {
9740
+ return !!f.memberPubkey && f.memberPubkey.toLowerCase() === recipientPubkey;
9741
+ }
9742
+ return true;
9743
+ }
9744
+ function bindSseStream(res, bus, filter = {}) {
9723
9745
  res.statusCode = 200;
9724
9746
  res.setHeader("Content-Type", "text/event-stream");
9725
9747
  res.setHeader("Cache-Control", "no-cache, no-transform");
@@ -9729,7 +9751,11 @@ function bindSseStream(res, bus) {
9729
9751
 
9730
9752
  `);
9731
9753
  let counter = 0;
9732
- const unsubscribe = bus.subscribe((e) => writeSse(res, e, ++counter));
9754
+ const unsubscribe = bus.subscribe((e) => {
9755
+ if (!shouldDeliver(e, filter))
9756
+ return;
9757
+ writeSse(res, e, ++counter);
9758
+ });
9733
9759
  const heartbeat = setInterval(() => {
9734
9760
  try {
9735
9761
  res.write(`: keepalive
@@ -10146,7 +10172,16 @@ function makeHandler(opts) {
10146
10172
  respond(res, 503, { error: "event bus not initialised" });
10147
10173
  return;
10148
10174
  }
10149
- bindSseStream(res, opts.bus);
10175
+ const filter = {};
10176
+ if (session?.presence?.sessionPubkey)
10177
+ filter.sessionPubkey = session.presence.sessionPubkey;
10178
+ if (session?.mesh) {
10179
+ filter.meshSlug = session.mesh;
10180
+ const meshCfg = opts.meshConfigs?.get(session.mesh);
10181
+ if (meshCfg?.pubkey)
10182
+ filter.memberPubkey = meshCfg.pubkey;
10183
+ }
10184
+ bindSseStream(res, opts.bus, filter);
10150
10185
  return;
10151
10186
  }
10152
10187
  if (req.method === "GET" && url.pathname === "/v1/peers") {
@@ -11857,7 +11892,9 @@ async function handleBrokerPush(msg, ctx) {
11857
11892
  priority,
11858
11893
  ...subtype ? { subtype } : {},
11859
11894
  body,
11860
- created_at: createdAt
11895
+ created_at: createdAt,
11896
+ ...ctx.recipientPubkey ? { recipient_pubkey: ctx.recipientPubkey } : {},
11897
+ ...ctx.recipientKind ? { recipient_kind: ctx.recipientKind } : {}
11861
11898
  });
11862
11899
  }
11863
11900
  async function decryptOrFallback(args) {
@@ -12069,22 +12106,7 @@ async function runDaemon(opts = {}) {
12069
12106
  }
12070
12107
  const bus = new EventBus;
12071
12108
  const cfg = readConfig();
12072
- let meshes;
12073
- if (opts.mesh) {
12074
- const found = cfg.meshes.find((m) => m.slug === opts.mesh);
12075
- if (!found) {
12076
- process.stderr.write(`mesh not found: ${opts.mesh}
12077
- `);
12078
- process.stderr.write(`joined meshes: ${cfg.meshes.map((m) => m.slug).join(", ") || "(none)"}
12079
- `);
12080
- releaseSingletonLock();
12081
- try {
12082
- outboxDb.close();
12083
- } catch {}
12084
- return 2;
12085
- }
12086
- meshes = [found];
12087
- } else if (cfg.meshes.length === 0) {
12109
+ if (cfg.meshes.length === 0) {
12088
12110
  process.stderr.write(`no mesh joined; run \`claudemesh join <invite-url>\` first
12089
12111
  `);
12090
12112
  releaseSingletonLock();
@@ -12092,9 +12114,8 @@ async function runDaemon(opts = {}) {
12092
12114
  outboxDb.close();
12093
12115
  } catch {}
12094
12116
  return 2;
12095
- } else {
12096
- meshes = cfg.meshes;
12097
12117
  }
12118
+ const meshes = cfg.meshes;
12098
12119
  const sessionBrokers = new Map;
12099
12120
  const sessionBrokersByPubkey = new Map;
12100
12121
  const brokers = new Map;
@@ -12102,7 +12123,6 @@ async function runDaemon(opts = {}) {
12102
12123
  for (const mesh of meshes) {
12103
12124
  meshConfigs.set(mesh.slug, mesh);
12104
12125
  const broker = new DaemonBrokerClient(mesh, {
12105
- displayName: opts.displayName,
12106
12126
  onStatusChange: (s) => {
12107
12127
  process.stdout.write(JSON.stringify({
12108
12128
  msg: "broker_status",
@@ -12130,7 +12150,9 @@ async function runDaemon(opts = {}) {
12130
12150
  if (lower === ownMember)
12131
12151
  return true;
12132
12152
  return sessionBrokersByPubkey.has(lower);
12133
- }
12153
+ },
12154
+ recipientPubkey: mesh.pubkey,
12155
+ recipientKind: "member"
12134
12156
  });
12135
12157
  }
12136
12158
  });
@@ -12169,6 +12191,7 @@ async function runDaemon(opts = {}) {
12169
12191
  prior.close().catch(() => {});
12170
12192
  }
12171
12193
  const sessionSecretKeyHex = info.presence.sessionSecretKey;
12194
+ const sessionPubkeyHex = info.presence.sessionPubkey;
12172
12195
  const client = new SessionBrokerClient({
12173
12196
  mesh: meshConfig,
12174
12197
  sessionPubkey: info.presence.sessionPubkey,
@@ -12186,7 +12209,9 @@ async function runDaemon(opts = {}) {
12186
12209
  meshSlug: meshConfig.slug,
12187
12210
  recipientSecretKeyHex: meshConfig.secretKey,
12188
12211
  sessionSecretKeyHex,
12189
- ackClientMessage: (cmid, bmid) => client.sendClientAck(cmid, bmid)
12212
+ ackClientMessage: (cmid, bmid) => client.sendClientAck(cmid, bmid),
12213
+ recipientPubkey: sessionPubkeyHex,
12214
+ recipientKind: "session"
12190
12215
  });
12191
12216
  }
12192
12217
  });
@@ -12234,6 +12259,7 @@ async function runDaemon(opts = {}) {
12234
12259
  }
12235
12260
  process.stdout.write(JSON.stringify({
12236
12261
  msg: "daemon_started",
12262
+ version: VERSION,
12237
12263
  pid: process.pid,
12238
12264
  sock: DAEMON_PATHS.SOCK_FILE,
12239
12265
  tcp: tcpEnabled ? `127.0.0.1:47823` : null,
@@ -12289,6 +12315,7 @@ var init_run = __esm(() => {
12289
12315
  init_inbound();
12290
12316
  init_identity();
12291
12317
  init_facade();
12318
+ init_urls();
12292
12319
  });
12293
12320
 
12294
12321
  // src/daemon/service-install.ts
@@ -12508,11 +12535,17 @@ async function runDaemonCommand(sub, opts, rest = []) {
12508
12535
  return printDaemonUsage();
12509
12536
  case "up":
12510
12537
  case "start":
12538
+ if (opts.mesh) {
12539
+ process.stderr.write(`[claudemesh] --mesh on \`daemon up\` is deprecated; the daemon attaches to every joined mesh automatically. ` + `Ignoring --mesh ${opts.mesh}.
12540
+ `);
12541
+ }
12542
+ if (opts.displayName) {
12543
+ process.stderr.write(`[claudemesh] --name on \`daemon up\` is deprecated; per-mesh display names live in config.json (set at join time), ` + `and session display names come from \`claudemesh launch --name\`. Ignoring --name ${opts.displayName}.
12544
+ `);
12545
+ }
12511
12546
  return runDaemon({
12512
12547
  tcpEnabled: !opts.noTcp,
12513
- publicHealthCheck: opts.publicHealth,
12514
- mesh: opts.mesh,
12515
- displayName: opts.displayName
12548
+ publicHealthCheck: opts.publicHealth
12516
12549
  });
12517
12550
  case "help":
12518
12551
  case "--help":
@@ -12555,11 +12588,10 @@ COMMANDS
12555
12588
  accept-host pin the current host fingerprint
12556
12589
  outbox list list local outbox rows (newest first)
12557
12590
  outbox requeue <id> re-enqueue an aborted / dead outbox row
12558
- install-service --mesh <s> write launchd (macOS) / systemd-user (Linux) unit
12591
+ install-service write launchd (macOS) / systemd-user (Linux) unit
12559
12592
  uninstall-service remove the platform service unit
12560
12593
 
12561
12594
  OPTIONS
12562
- --mesh <slug> attach to / target this mesh
12563
12595
  --name <displayName> override CLAUDEMESH_DISPLAY_NAME
12564
12596
  --no-tcp disable the loopback TCP listener (UDS only)
12565
12597
  --public-health expose /v1/health unauthenticated on TCP
@@ -12667,11 +12699,17 @@ async function runInstallService(opts) {
12667
12699
  return 1;
12668
12700
  }
12669
12701
  }
12702
+ if (opts.mesh) {
12703
+ process.stderr.write(`[claudemesh] --mesh on \`daemon install-service\` is deprecated and ignored; the daemon attaches to every joined mesh.
12704
+ `);
12705
+ }
12706
+ if (opts.displayName) {
12707
+ process.stderr.write(`[claudemesh] --name on \`daemon install-service\` is deprecated and ignored; per-mesh names live in config.json, session names come from \`claudemesh launch --name\`.
12708
+ `);
12709
+ }
12670
12710
  try {
12671
12711
  const r = installService2({
12672
- binaryPath: binary,
12673
- ...opts.mesh ? { meshSlug: opts.mesh } : {},
12674
- ...opts.displayName ? { displayName: opts.displayName } : {}
12712
+ binaryPath: binary
12675
12713
  });
12676
12714
  if (opts.json) {
12677
12715
  process.stdout.write(JSON.stringify({ ok: true, ...r }) + `
@@ -19978,16 +20016,18 @@ Security
19978
20016
  claudemesh backup [file] encrypt config → portable recovery file
19979
20017
  claudemesh restore <file> restore config from a backup file
19980
20018
 
19981
- Daemon (long-lived peer mesh runtime, v0.9.0)
19982
- claudemesh daemon up start daemon (alias: start) [--mesh <slug>] [--no-tcp]
20019
+ Daemon (long-lived peer mesh runtime — universal across every joined mesh)
20020
+ claudemesh daemon up start daemon (alias: start) [--no-tcp]
19983
20021
  claudemesh daemon status show running pid + IPC health [--json]
19984
20022
  claudemesh daemon down stop daemon (alias: stop)
19985
20023
  claudemesh daemon version ipc + schema version of running daemon
19986
20024
  claudemesh daemon outbox list list local outbox rows [--failed|--pending|--inflight|--done]
19987
20025
  claudemesh daemon outbox requeue <id> re-enqueue an aborted/dead row [--new-client-id <id>]
19988
20026
  claudemesh daemon accept-host pin current host fingerprint
19989
- claudemesh daemon install-service --mesh <slug> write launchd / systemd-user unit
19990
- claudemesh daemon uninstall-service remove the unit
20027
+ claudemesh daemon install-service write launchd / systemd-user unit
20028
+ claudemesh daemon uninstall-service remove the unit
20029
+ Note: the daemon attaches to every mesh in ~/.claudemesh/config.json
20030
+ automatically; --mesh on up / install-service is deprecated and ignored.
19991
20031
 
19992
20032
  Setup
19993
20033
  claudemesh install register MCP server + hooks
@@ -21089,4 +21129,4 @@ main().catch((err) => {
21089
21129
  process.exit(EXIT.INTERNAL_ERROR);
21090
21130
  });
21091
21131
 
21092
- //# debugId=7232363C9624744664756E2164756E21
21132
+ //# debugId=80324EA6AC54078664756E2164756E21