claudemesh-cli 1.34.1 → 1.34.2

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.1", env;
107
+ var URLS, VERSION = "1.34.2", env;
108
108
  var init_urls = __esm(() => {
109
109
  URLS = {
110
110
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -18468,6 +18468,11 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
18468
18468
  });
18469
18469
  const transport = new StdioServerTransport;
18470
18470
  await server.connect(transport);
18471
+ const WELCOME_DELAY_MS = 5000;
18472
+ const WELCOME_LOOKBACK_MS = 24 * 60 * 60 * 1000;
18473
+ setTimeout(() => {
18474
+ emitInboxWelcome(server, mcpLog, WELCOME_LOOKBACK_MS);
18475
+ }, WELCOME_DELAY_MS);
18471
18476
  const keepalive = setInterval(() => {}, 1000);
18472
18477
  const shutdown = () => {
18473
18478
  clearInterval(keepalive);
@@ -18477,6 +18482,70 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
18477
18482
  process.on("SIGTERM", shutdown);
18478
18483
  process.on("SIGINT", shutdown);
18479
18484
  }
18485
+ async function emitInboxWelcome(server, mcpLog, lookbackMs) {
18486
+ const sinceIso = new Date(Date.now() - lookbackMs).toISOString();
18487
+ const path2 = `/v1/inbox?since=${encodeURIComponent(sinceIso)}&limit=20`;
18488
+ let body;
18489
+ try {
18490
+ const res = await daemonGet(path2);
18491
+ if (res.status !== 200) {
18492
+ mcpLog("welcome_skip", { reason: "ipc_status", status: res.status });
18493
+ return;
18494
+ }
18495
+ body = res.body;
18496
+ } catch (e) {
18497
+ mcpLog("welcome_skip", { reason: "ipc_threw", err: String(e) });
18498
+ return;
18499
+ }
18500
+ const items = Array.isArray(body.items) ? body.items : [];
18501
+ if (items.length === 0) {
18502
+ mcpLog("welcome_skip", { reason: "empty" });
18503
+ return;
18504
+ }
18505
+ const byMesh = new Map;
18506
+ for (const it of items) {
18507
+ const meshSlug = String(it.mesh ?? "");
18508
+ const arr = byMesh.get(meshSlug) ?? [];
18509
+ arr.push(it);
18510
+ byMesh.set(meshSlug, arr);
18511
+ }
18512
+ const preview = items.slice(0, 3).map((it) => {
18513
+ const sender = String(it.sender_name ?? "unknown");
18514
+ const senderPub = String(it.sender_pubkey ?? "").slice(0, 8);
18515
+ const meshSlug = String(it.mesh ?? "");
18516
+ const bodyText = (typeof it.body === "string" ? it.body : "(encrypted)").slice(0, 60);
18517
+ const ts = String(it.received_at ?? "");
18518
+ const time = ts ? new Date(ts).toLocaleTimeString() : "";
18519
+ const tag = sender !== senderPub ? `${sender} (${senderPub})` : senderPub;
18520
+ return ` ${tag} [${meshSlug}] ${time}: ${bodyText}`;
18521
+ }).join(`
18522
+ `);
18523
+ const remainder = items.length > 3 ? `
18524
+ …and ${items.length - 3} more` : "";
18525
+ const meshList = [...byMesh.keys()].filter(Boolean).join(", ");
18526
+ const header = `\uD83D\uDCE5 [welcome] ${items.length} message${items.length === 1 ? "" : "s"} in inbox from the last 24h${meshList ? ` (${meshList})` : ""}`;
18527
+ const footer = `
18528
+ Run \`claudemesh inbox\` for full content.`;
18529
+ const content = `${header}
18530
+ ${preview}${remainder}${footer}`;
18531
+ try {
18532
+ await server.notification({
18533
+ method: "notifications/claude/channel",
18534
+ params: {
18535
+ content,
18536
+ meta: {
18537
+ kind: "welcome",
18538
+ unread_count: items.length,
18539
+ meshes: [...byMesh.keys()],
18540
+ latest_message_ids: items.slice(0, 10).map((it) => String(it.id ?? ""))
18541
+ }
18542
+ }
18543
+ });
18544
+ mcpLog("welcome_emitted", { count: items.length, meshes: [...byMesh.keys()] });
18545
+ } catch (err) {
18546
+ mcpLog("welcome_emit_failed", { err: String(err) });
18547
+ }
18548
+ }
18480
18549
  async function startServiceProxy(serviceName) {
18481
18550
  const config = readConfig();
18482
18551
  if (config.meshes.length === 0) {
@@ -20513,4 +20582,4 @@ main().catch((err) => {
20513
20582
  process.exit(EXIT.INTERNAL_ERROR);
20514
20583
  });
20515
20584
 
20516
- //# debugId=CC0DC435F105164564756E2164756E21
20585
+ //# debugId=FD137608913AB26764756E2164756E21