claudemesh-cli 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +84 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6514,7 +6514,7 @@ function loadConfig() {
6514
6514
  if (!parsed || !Array.isArray(parsed.meshes)) {
6515
6515
  return { version: 1, meshes: [] };
6516
6516
  }
6517
- return { version: 1, meshes: parsed.meshes, displayName: parsed.displayName, groups: parsed.groups };
6517
+ return { version: 1, meshes: parsed.meshes, displayName: parsed.displayName, groups: parsed.groups, messageMode: parsed.messageMode };
6518
6518
  } catch (e) {
6519
6519
  throw new Error(`Failed to load ${CONFIG_PATH}: ${e instanceof Error ? e.message : String(e)}`);
6520
6520
  }
@@ -47921,6 +47921,7 @@ async function startMcpServer() {
47921
47921
  const config2 = loadConfig();
47922
47922
  const myName = config2.displayName ?? "unnamed";
47923
47923
  const myGroups = (config2.groups ?? []).map((g) => `@${g.name}${g.role ? ":" + g.role : ""}`).join(", ") || "none";
47924
+ const messageMode = config2.messageMode ?? "push";
47924
47925
  const server = new Server({ name: "claudemesh", version: "0.3.0" }, {
47925
47926
  capabilities: {
47926
47927
  experimental: { "claude/channel": {} },
@@ -48023,7 +48024,13 @@ Create and claim work items. create_task to propose work, claim_task to take own
48023
48024
  - "low": pull-only via check_messages (FYI, non-blocking context)
48024
48025
 
48025
48026
  ## Coordination
48026
- Call list_peers at session start to understand who is online, their roles, and what they are working on. If you are a group lead, gather input from members before responding to external requests — do not answer alone. If you are a member, contribute to your lead when asked. Use @group messages for team-wide questions, direct messages for 1:1 coordination. Set a meaningful summary so peers know your current focus.`
48027
+ Call list_peers at session start to understand who is online, their roles, and what they are working on. If you are a group lead, gather input from members before responding to external requests — do not answer alone. If you are a member, contribute to your lead when asked. Use @group messages for team-wide questions, direct messages for 1:1 coordination. Set a meaningful summary so peers know your current focus.
48028
+
48029
+ ## Message Mode
48030
+ Your message mode is "${messageMode}".
48031
+ - push: messages arrive in real-time as channel notifications. Respond immediately.
48032
+ - inbox: messages are held. You'll see "[inbox] New message from X" notifications. Call check_messages to read them.
48033
+ - off: no message notifications. Use check_messages manually to poll.`
48027
48034
  });
48028
48035
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
48029
48036
  tools: TOOLS
@@ -48563,29 +48570,47 @@ ${rows.join(`
48563
48570
  const transport = new StdioServerTransport;
48564
48571
  await server.connect(transport);
48565
48572
  for (const client of allClients()) {
48566
- client.onPush(async (msg) => {
48567
- const fromPubkey = msg.senderPubkey || "";
48568
- const fromName = fromPubkey ? await resolvePeerName(client, fromPubkey) : "unknown";
48569
- const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
48570
- try {
48571
- await server.notification({
48572
- method: "notifications/claude/channel",
48573
- params: {
48574
- content,
48575
- meta: {
48576
- from_id: fromPubkey,
48577
- from_name: fromName,
48578
- mesh_slug: client.meshSlug,
48579
- mesh_id: client.meshId,
48580
- priority: msg.priority,
48581
- sent_at: msg.createdAt,
48582
- delivered_at: msg.receivedAt,
48583
- kind: msg.kind
48584
- }
48573
+ if (messageMode !== "off") {
48574
+ const pushPollTimer = setInterval(async () => {
48575
+ const buffered = client.drainPushBuffer();
48576
+ for (const msg of buffered) {
48577
+ const fromPubkey = msg.senderPubkey || "";
48578
+ const fromName = fromPubkey ? await resolvePeerName(client, fromPubkey) : "unknown";
48579
+ if (messageMode === "inbox") {
48580
+ try {
48581
+ await server.notification({
48582
+ method: "notifications/claude/channel",
48583
+ params: {
48584
+ content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
48585
+ meta: { kind: "inbox_notification", from_name: fromName }
48586
+ }
48587
+ });
48588
+ } catch {}
48589
+ continue;
48585
48590
  }
48586
- });
48587
- } catch {}
48588
- });
48591
+ const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
48592
+ try {
48593
+ await server.notification({
48594
+ method: "notifications/claude/channel",
48595
+ params: {
48596
+ content,
48597
+ meta: {
48598
+ from_id: fromPubkey,
48599
+ from_name: fromName,
48600
+ mesh_slug: client.meshSlug,
48601
+ mesh_id: client.meshId,
48602
+ priority: msg.priority,
48603
+ sent_at: msg.createdAt,
48604
+ delivered_at: msg.receivedAt,
48605
+ kind: msg.kind
48606
+ }
48607
+ }
48608
+ });
48609
+ } catch {}
48610
+ }
48611
+ }, 1000);
48612
+ pushPollTimer.unref();
48613
+ }
48589
48614
  client.onStreamData(async (evt) => {
48590
48615
  try {
48591
48616
  await server.notification({
@@ -49222,6 +49247,7 @@ function parseArgs(argv) {
49222
49247
  groups: null,
49223
49248
  joinLink: null,
49224
49249
  meshSlug: null,
49250
+ messageMode: null,
49225
49251
  quiet: false,
49226
49252
  skipPermConfirm: false,
49227
49253
  claudeArgs: []
@@ -49249,6 +49275,10 @@ function parseArgs(argv) {
49249
49275
  result.meshSlug = argv[++i];
49250
49276
  } else if (arg.startsWith("--mesh=")) {
49251
49277
  result.meshSlug = arg.slice("--mesh=".length);
49278
+ } else if (arg === "--inbox") {
49279
+ result.messageMode = "inbox";
49280
+ } else if (arg === "--no-messages") {
49281
+ result.messageMode = "off";
49252
49282
  } else if (arg === "--quiet") {
49253
49283
  result.quiet = true;
49254
49284
  } else if (arg === "-y" || arg === "--yes") {
@@ -49334,16 +49364,22 @@ async function confirmPermissions() {
49334
49364
  });
49335
49365
  });
49336
49366
  }
49337
- function printBanner(name, meshSlug, role, groups) {
49367
+ function printBanner(name, meshSlug, role, groups, messageMode) {
49338
49368
  const useColor = !process.env.NO_COLOR && process.env.TERM !== "dumb" && process.stdout.isTTY;
49339
49369
  const dim = (s) => useColor ? `\x1B[2m${s}\x1B[22m` : s;
49340
49370
  const bold = (s) => useColor ? `\x1B[1m${s}\x1B[22m` : s;
49341
49371
  const roleSuffix = role ? ` (${role})` : "";
49342
49372
  const groupTags = groups.length ? " [" + groups.map((g) => `@${g.name}${g.role ? `:${g.role}` : ""}`).join(", ") + "]" : "";
49343
49373
  const rule = "─".repeat(60);
49344
- console.log(bold(`claudemesh launch`) + dim(` — as ${name}${roleSuffix} on ${meshSlug}${groupTags}`));
49374
+ console.log(bold(`claudemesh launch`) + dim(` — as ${name}${roleSuffix} on ${meshSlug}${groupTags} [${messageMode}]`));
49345
49375
  console.log(rule);
49346
- console.log("Peer messages arrive as <channel> reminders in real-time.");
49376
+ if (messageMode === "push") {
49377
+ console.log("Peer messages arrive as <channel> reminders in real-time.");
49378
+ } else if (messageMode === "inbox") {
49379
+ console.log("Peer messages held in inbox. Use check_messages to read.");
49380
+ } else {
49381
+ console.log("Messages off. Use check_messages to poll manually.");
49382
+ }
49347
49383
  console.log("Peers send text only — they cannot call tools or read files.");
49348
49384
  console.log(dim(`Config: ${getConfigPath()}`));
49349
49385
  console.log(rule);
@@ -49398,6 +49434,7 @@ async function runLaunch(extraArgs) {
49398
49434
  const displayName = args.name ?? `${hostname2()}-${process.pid}`;
49399
49435
  let role = args.role;
49400
49436
  let parsedGroups = args.groups ? parseGroupsString(args.groups) : [];
49437
+ let messageMode = args.messageMode ?? "push";
49401
49438
  if (!args.quiet) {
49402
49439
  if (role === null) {
49403
49440
  const answer = await askLine(" Role (optional): ");
@@ -49409,6 +49446,22 @@ async function runLaunch(extraArgs) {
49409
49446
  if (answer)
49410
49447
  parsedGroups = parseGroupsString(answer);
49411
49448
  }
49449
+ if (args.messageMode === null) {
49450
+ console.log(`
49451
+ Message mode:`);
49452
+ console.log(" 1) Push (real-time, peers can interrupt your work)");
49453
+ console.log(" 2) Inbox (held until you check, notification only)");
49454
+ console.log(" 3) Off (tools only, no messages)");
49455
+ console.log("");
49456
+ const answer = await askLine(" Choice [1]: ");
49457
+ const choice = parseInt(answer || "1", 10);
49458
+ if (choice === 2)
49459
+ messageMode = "inbox";
49460
+ else if (choice === 3)
49461
+ messageMode = "off";
49462
+ else
49463
+ messageMode = "push";
49464
+ }
49412
49465
  if (role || parsedGroups.length)
49413
49466
  console.log("");
49414
49467
  }
@@ -49428,12 +49481,13 @@ async function runLaunch(extraArgs) {
49428
49481
  version: 1,
49429
49482
  meshes: [mesh],
49430
49483
  displayName,
49431
- ...parsedGroups.length > 0 ? { groups: parsedGroups } : {}
49484
+ ...parsedGroups.length > 0 ? { groups: parsedGroups } : {},
49485
+ messageMode
49432
49486
  };
49433
49487
  writeFileSync4(join4(tmpDir, "config.json"), JSON.stringify(sessionConfig, null, 2) + `
49434
49488
  `, "utf-8");
49435
49489
  if (!args.quiet) {
49436
- printBanner(displayName, mesh.slug, role, parsedGroups);
49490
+ printBanner(displayName, mesh.slug, role, parsedGroups, messageMode);
49437
49491
  if (!args.skipPermConfirm) {
49438
49492
  await confirmPermissions();
49439
49493
  }
@@ -49501,7 +49555,7 @@ init_config();
49501
49555
  // package.json
49502
49556
  var package_default = {
49503
49557
  name: "claudemesh-cli",
49504
- version: "0.5.0",
49558
+ version: "0.5.2",
49505
49559
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
49506
49560
  keywords: [
49507
49561
  "claude-code",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudemesh-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",