claudemesh-cli 0.5.3 → 0.5.5

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 +94 -48
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -46745,6 +46745,20 @@ var TOOLS = [
46745
46745
  name: "mesh_info",
46746
46746
  description: "Get a complete overview of the mesh: peers, groups, state, memory, files, tasks, streams, tables. Call on session start for full situational awareness.",
46747
46747
  inputSchema: { type: "object", properties: {} }
46748
+ },
46749
+ {
46750
+ name: "ping_mesh",
46751
+ description: "Send test messages through the full pipeline and measure round-trip timing per priority. Diagnoses push delivery issues.",
46752
+ inputSchema: {
46753
+ type: "object",
46754
+ properties: {
46755
+ priorities: {
46756
+ type: "array",
46757
+ items: { type: "string", enum: ["now", "next", "low"] },
46758
+ description: 'Priorities to test (default: ["now", "next"])'
46759
+ }
46760
+ }
46761
+ }
46748
46762
  }
46749
46763
  ];
46750
46764
 
@@ -48561,6 +48575,46 @@ ${rows.join(`
48561
48575
  ];
48562
48576
  return text(lines.join(`
48563
48577
  `));
48578
+ }
48579
+ case "ping_mesh": {
48580
+ const { priorities: pingPriorities } = args ?? {};
48581
+ const toTest = pingPriorities ?? ["now", "next"];
48582
+ const client = allClients()[0];
48583
+ if (!client)
48584
+ return text("ping_mesh: not connected", true);
48585
+ const results = [];
48586
+ for (const prio of toTest) {
48587
+ const sendTime = Date.now();
48588
+ const pingId = `ping-${sendTime}-${prio}`;
48589
+ const sendResult = await client.send("*", `__ping__${pingId}`, prio);
48590
+ const ackTime = Date.now();
48591
+ if (!sendResult.ok) {
48592
+ results.push(`[${prio}] SEND FAILED: ${sendResult.error}`);
48593
+ continue;
48594
+ }
48595
+ let received = false;
48596
+ let receiveTime = 0;
48597
+ for (let i = 0;i < 100; i++) {
48598
+ await new Promise((r) => setTimeout(r, 100));
48599
+ const buffer = client.pushHistory;
48600
+ const match = buffer.find((m) => m.plaintext?.includes(pingId) || false);
48601
+ if (match) {
48602
+ received = true;
48603
+ receiveTime = Date.now();
48604
+ break;
48605
+ }
48606
+ }
48607
+ if (received) {
48608
+ results.push(`[${prio}] OK — send→ack: ${ackTime - sendTime}ms, send→receive: ${receiveTime - sendTime}ms`);
48609
+ } else {
48610
+ const peers = await client.listPeers();
48611
+ const selfStatus = peers.find((p) => p.displayName === myName)?.status ?? "unknown";
48612
+ results.push(`[${prio}] NOT RECEIVED in 10s (your status: ${selfStatus}${selfStatus === "working" ? " — broker holds next/low" : ""})`);
48613
+ }
48614
+ }
48615
+ return text(`Ping results:
48616
+ ${results.join(`
48617
+ `)}`);
48564
48618
  }
48565
48619
  default:
48566
48620
  return text(`Unknown tool: ${name}`, true);
@@ -48570,56 +48624,48 @@ ${rows.join(`
48570
48624
  const transport = new StdioServerTransport;
48571
48625
  await server.connect(transport);
48572
48626
  for (const client of allClients()) {
48573
- if (messageMode !== "off") {
48574
- const pushPollTimer = setInterval(async () => {
48575
- const buffered = client.drainPushBuffer();
48576
- if (buffered.length > 0) {
48577
- process.stderr.write(`[claudemesh] poll: ${buffered.length} message(s) to push
48578
- `);
48579
- }
48580
- for (const msg of buffered) {
48581
- const fromPubkey = msg.senderPubkey || "";
48582
- const fromName = fromPubkey ? await resolvePeerName(client, fromPubkey) : "unknown";
48583
- if (messageMode === "inbox") {
48584
- try {
48585
- await server.notification({
48586
- method: "notifications/claude/channel",
48587
- params: {
48588
- content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
48589
- meta: { kind: "inbox_notification", from_name: fromName }
48590
- }
48591
- });
48592
- } catch {}
48593
- continue;
48627
+ client.onPush(async (msg) => {
48628
+ if (messageMode === "off")
48629
+ return;
48630
+ const fromPubkey = msg.senderPubkey || "";
48631
+ const fromName = fromPubkey ? await resolvePeerName(client, fromPubkey) : "unknown";
48632
+ if (messageMode === "inbox") {
48633
+ try {
48634
+ await server.notification({
48635
+ method: "notifications/claude/channel",
48636
+ params: {
48637
+ content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
48638
+ meta: { kind: "inbox_notification", from_name: fromName }
48639
+ }
48640
+ });
48641
+ } catch {}
48642
+ return;
48643
+ }
48644
+ const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
48645
+ try {
48646
+ await server.notification({
48647
+ method: "notifications/claude/channel",
48648
+ params: {
48649
+ content,
48650
+ meta: {
48651
+ from_id: fromPubkey,
48652
+ from_name: fromName,
48653
+ mesh_slug: client.meshSlug,
48654
+ mesh_id: client.meshId,
48655
+ priority: msg.priority,
48656
+ sent_at: msg.createdAt,
48657
+ delivered_at: msg.receivedAt,
48658
+ kind: msg.kind
48659
+ }
48594
48660
  }
48595
- const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
48596
- try {
48597
- await server.notification({
48598
- method: "notifications/claude/channel",
48599
- params: {
48600
- content,
48601
- meta: {
48602
- from_id: fromPubkey,
48603
- from_name: fromName,
48604
- mesh_slug: client.meshSlug,
48605
- mesh_id: client.meshId,
48606
- priority: msg.priority,
48607
- sent_at: msg.createdAt,
48608
- delivered_at: msg.receivedAt,
48609
- kind: msg.kind
48610
- }
48611
- }
48612
- });
48613
- process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
48661
+ });
48662
+ process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
48614
48663
  `);
48615
- } catch (pushErr) {
48616
- process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
48664
+ } catch (pushErr) {
48665
+ process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
48617
48666
  `);
48618
- }
48619
- }
48620
- }, 1000);
48621
- pushPollTimer.unref();
48622
- }
48667
+ }
48668
+ });
48623
48669
  client.onStreamData(async (evt) => {
48624
48670
  try {
48625
48671
  await server.notification({
@@ -49564,7 +49610,7 @@ init_config();
49564
49610
  // package.json
49565
49611
  var package_default = {
49566
49612
  name: "claudemesh-cli",
49567
- version: "0.5.3",
49613
+ version: "0.5.5",
49568
49614
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
49569
49615
  keywords: [
49570
49616
  "claude-code",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudemesh-cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",